I am trying to load a DataSet from an xml file that has 2 tables in
it. Any help would be great. Here is the C# code snipit on how I
load it. Instead of geting a dataset with 2 table I am geting a
dataset with 4 tables in it. All four tables have no rows.
DataSet lds_working = new DataSet( "PB_TABLES");
ls_schema = MapPath("two_table.xsd");
lds_working.ReadXmlSchema(ls_schema);
lds_working.ReadXml(MapPath("two_table.xml"));
Here is the XSD
<?xml version="1.0" ?>
<xs:schema id="PB_TABLES"
targetNamespace="http://tempuri.org/two_table1.xsd"
xmlns:mstns="http://tempuri.org/two_table1.xsd"
xmlns="http://tempuri.org/two_table1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="PB_TABLES" msdata:IsDataSet="true"
msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="d_student_by_name">
<xs:complexType>
<xs:sequence>
<xs:element name="d_student_by_name_row" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="stud_id" type="xs:long" minOccurs="0" />
<xs:element name="ent_main_id" type="xs:long" minOccurs="0"
/>
<xs:element name="enrtype_id" type="xs:long" minOccurs="0"
/>
<xs:element name="enr_id" type="xs:long" minOccurs="0" />
<xs:element name="student_name" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="d_second">
<xs:complexType>
<xs:sequence>
<xs:element name="d_second_row" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="stud_id" type="xs:long" minOccurs="0" />
<xs:element name="ent_main_id" type="xs:long" minOccurs="0"
/>
<xs:element name="enrtype_id" type="xs:long" minOccurs="0"
/>
<xs:element name="enr_id" type="xs:long" minOccurs="0" />
<xs:element name="student_name" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Here is the xml file:
<?xml version="1.0" standalone="yes"?>
<PB_TABLES >
<d_student_by_name>
<d_student_by_name_row>
<stud_id>81661</stud_id>
<ent_main_id>81533</ent_main_id>
<enrtype_id>85426</enrtype_id>
<enr_id>83008</enr_id>
<student_name>Charle Brown</student_name>
</d_student_by_name_row>
<d_student_by_name_row>
<stud_id>135600</stud_id>
<ent_main_id>135428</ent_main_id>
<enrtype_id>141385</enrtype_id>
<enr_id>137663</enr_id>
<student_name>Lucy</student_name>
</d_student_by_name_row>
<d_student_by_name_row>
<stud_id>455249</stud_id>
<ent_main_id>454022</ent_main_id>
<enrtype_id>287408</enrtype_id>
<enr_id>475810</enr_id>
<student_name>Snoopy</student_name>
</d_student_by_name_row>
</d_student_by_name>
<d_second_row>
<d_second_row_row>
<stud_id>81661</stud_id>
<ent_main_id>81533</ent_main_id>
<enrtype_id>85426</enrtype_id>
<enr_id>83008</enr_id>
<student_name>Dancer</student_name>
</d_second_row_row>
<d_second_row_row>
<stud_id>135600</stud_id>
<ent_main_id>135428</ent_main_id>
<enrtype_id>141385</enrtype_id>
<enr_id>137663</enr_id>
<student_name>Prancer</student_name>
</d_second_row_row>
<d_second_row_row>
<stud_id>455249</stud_id>
<ent_main_id>454022</ent_main_id>
<enrtype_id>287408</enrtype_id>
<enr_id>475810</enr_id>
<student_name>Comet</student_name>
</d_second_row_row>
</d_second_row>
</PB_TABLES>
Thanks in advance