Currently, I am unable to access the content of any of the comments in the XSD I am attempting to read from.
Here is a snippet of the XSD I am trying to read comments from:
<xs:schema>
<xs:complexType name="typeName">
<xs:choice>
<xs:element name="elementName" type="someOtherType"><!--This is a comment I would like to access.--></xs:element>
</xs:choice>
</xs:complexType>
</xs:schema>
I happen to be using VB.Net. Here is a snippet of the class that is attempting to access the XML comment from the above XSD:
Public Class QAutoTestXSD
Private XML As MSXML2.DOMDocument60
Public Sub New()
XML = New MSXML2.DOMDocument60
Call XML.setProperty("SelectionNamespaces", "xmlns:xs='http://www.w3.org/2001/XMLSchema'")
XML.async = False
If Not XML.load("C:\myXML.xml") Then
Call handleParsingError
End If
End Sub
Public Function getXSDComment(typeName As String, elementName As String) As String
getXSDComment = XML.selectSingleNode("/xs:schema/xs:complexType[@name='" & typeName & "TestType']/xs:choice/xs:element[@name='" & elementName & "']/comment()").nodeValue
End Function
End Class
By modifying the XPATH argument of selectSingleNode, I am able to successfully access all other node types in the XSD, however I have yet to successfully select any nodes of comment type, even using "//comment()". Any help would be much appreciated!