myXmlDataDoc.DataSet.ReadXml problem

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2010-05-28T01:01:07Z Indexed on 2010/05/28 1:11 UTC
Read the original article Hit count: 249

Filed under:
|

Hi:

I am using myXmlDataDoc.DataSet.ReadXml(xml_file_name, XmlReadMode.InferSchema);

to populate the tables within the dataset created by reading in a xml schema using:

myStreamReader = new StreamReader(xsd_file_name);
myXmlDataDoc.DataSet.ReadXmlSchema(myStreamReader);

The problems I am facing is when it comes to read the xml tag:

The readXml function puts the element in a different table and everything in the tables are 0s. Here is the print out of the datatable:

TableName: test_data
 100     2   1  
TableName: parameters
 1   0
 2   0
 3   0
 4   0
 5   0
 6   0
 7   0
 8   0
 9   0
 10  0
 11  0
 12  0

In my xsd file, I represent an array using this:

<xs:element name="test_data">
<xs:complexType>
  <xs:complexContent>
    <xs:extension base="test_base">
      <xs:sequence>
        <xs:element name="a" type="xs:unsignedShort"/>
        <xs:element name="b" type="xs:unsignedShort"/>
        <xs:element name="c" type="xs:unsignedInt"/>
        <xs:element name="parameters" minOccurs="0" maxOccurs="12" type="xs:unsignedInt"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

And here is my xml file:

100 2 1 1 2 3 4 5 6 7 8 9 10 11 12

I am expecting after the readXml function call, the "parameters" is part of the test_data table.

TableName: test_data
 100     2   1  1   2  3  4  5  6  7  8  9  10  11  12

Does anyone knows what's wrong?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml