Access to XSD annotations from VBA


  • 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:appInfo>W3Schools Note</xs:appInfo>
      <xs:documentation xml:lang="en">
      This Schema defines a W3Schools note!

    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.


    • 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 e.g.

      Dim myAnnotationDoc As New MSXML2.DOMDocument60


    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