read xml schema

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eran otzar
    New Member
    • Jan 2011
    • 13

    read xml schema

    hello,
    ive got an xml schema wich is placed inside of an xml file
    it is placed as one of the descendants of the first Node , this xml file represnt a table
    Code:
    <?xml version="1.0" standalone="yes"?>
    <NewDataSet>
       <xs:schema .....    
             .
              <xs:element name="Table">
              <xs:complexType>
                  <xs:sequence>
                    <xs:element name="OrderID" type="xs:int" minOccurs="0" />
                    <xs:element name="ProductID" type="xs:int" minOccurs="0" />
                    <xs:element name="UnitPrice" type="xs:decimal" minOccurs="0" />
                    <xs:element name="Quantity" type="xs:short" minOccurs="0" />
                    <xs:element name="Discount" type="xs:float" minOccurs="0" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              .
              .
       </xs:schema>
       <Record>
            // FIELD NODES
       </Record>
       <Record>
           // FIELD NODES
       </Record>
       .
       .
           // MORE RECORDS 
    <NewDataSet>
    i need to retrive the the name and the type of the fields in order to create an Entity that would represent a record , i cannot use built in ADO.NET function to create a dataset from this file.

    i could use xmlDocument and traverse threw the schema untill finding the node with the name="table" , attribute .

    im looking for a simple better looking way to do the above .
    Linq to xml would of been the most appropriate way but it seems to have a problem with
    Descendants("xs :element") with the ":" to be more specific .

    thanks in advance .
    Last edited by Dormilich; Jun 15 '11, 01:50 PM. Reason: please use [CODE] [/CODE] tags when posting code
Working...