none
Access to XSD annotations from VBA

    Question

  • Hello,

    I'm currently using MSXML6 from VBA (Excel 2007), and I can't find a way to access the "annotation" nodes nor "appinfo" or "documentation" of an element for example:

    <xs:annotation>

      <xs:appInfo>W3Schools Note</xs:appInfo>
      <xs:documentation xml:lang="en">
      This Schema defines a W3Schools note!
      </xs:documentation>
    </xs:annotation>

    Using the debugger, I can browse my ISchemaElement, but can't find any object which contains the annotations. Am I missing something? How to read those annotations?

    Thanks in advance.

    Nicolas


    • Edited by ncasaux Tuesday, June 11, 2013 12:29 PM
    Tuesday, June 11, 2013 12:28 PM

All replies

  • I think you need to use http://msdn.microsoft.com/en-us/library/windows/desktop/ms766478%28v=vs.85%29.aspx e.g.

      Dim myAnnotationDoc As New MSXML2.DOMDocument60

      yourSchemaElement.writeAnnotation(myAnnotationsDoc)

    Then you can access the annotation using the normal DOM methods of MSXML (e.g. DOM Level 1 Core and MSXML XPath 1.0 (selectNodes, selectSingleNode)) in the populated myAnnotationsDoc.

    So basically create an MSXML 6 DOM document or node to be populated with the annotation, then call the writeAnnotation method on your schema item to populate the DOM node.


    MVP (XML, Data Platform Development) 2005/04 - 2013/03 My blog

    • Proposed as answer by Martin Honnen Wednesday, June 12, 2013 10:02 AM
    Tuesday, June 11, 2013 12:45 PM