How to read an XSD file?

Origami

Member
Joined
Jan 12, 2011
Messages
8
Programming Experience
5-10
Hi all,

I'd like your help and advice on how to read an XSD file with VB.NET.

Here is an example of the XSD file I want to read :

VB.NET:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 
  <xs:group name="TOTO">
    <xs:choice>
      <xs:element name="Person" type="Person" />
      <xs:element name="Telephone" type="Telephone" />
    </xs:choice>
  </xs:group>  
  
  <xs:group name="TATA">
    <xs:choice>
      <xs:element name="Subscriber" type="Subscriber" />
      <xs:element name="Communication" type="Communication" />
    </xs:choice>
  </xs:group>
  
  </xs:schema>

I found somewhere on the Internet the following code :

VB.NET:
Dim iter As XPathNodeIterator = nav.Select("xs:schema/xs:group/xs:choice", mgr)
' For each choice
While iter.MoveNext
  Dim lineElement As String = iter.Current.SelectSingleNode("xs:element", mgr).OuterXml()
   ReDim iBaseXML_Plugin.tabTypEntXSD(0)
   iBaseXML_Plugin.tabTypEntXSD(0) = get_typ_ent_from_xsd(lineElement)
   MsgBox("type = " & iBaseXML_Plugin.tabTypEntXSD(0))
End While

The problem is that it only returns the first element of each main tag ("Person" and "Subscriber"), and not the second one.

Do you know how to read each child of the main element ?

Thanks a lot for your help.
 
Back
Top