473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Problems using ReadXmlSchema to read two tables into ds

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
Nov 12 '05 #1
0 1232

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: DraguVaso | last post by:
Hi, I should use XML to synchronize the data from different (VB.NET) applications, and I was just wondering which Overloads of these functions ( ReadXmlSchema, ReadXml and WriteXml) goes the...
1
by: Jonathan Gibbs | last post by:
I'm very new to xml, and struggling a bit.. I want to use an .xsd file passed to a windows application to define a dataset's schema, and also (if possible) pass other metadata associated with...
0
by: Greg | last post by:
I'm trying to use the ReadXmlSchema method of the DataSet class from behind a firewall/proxy server and can't get it to work. I can run the code on a machine not behind the firewall and it works...
0
by: Derrick | last post by:
Hi All - I have a custom generated DataSet subclass, generated by the XSD tool, based on an xsd document that was created (by xsd tool) from an xml doc. I can read the doc in via...
0
by: Terry Brown | last post by:
I have an xml file: <?xml version="1.0" encoding="utf-8" ?> <G2Registers xmlns="http://tempuri.org/registers.xsd"> <register> <name>Version Register</name> <address>"00000000"</address>...
3
by: Eric | last post by:
Help! I created a XML schema with a Visual Studio tools. I'm filling a dataset with a DataAdapter. Before I use the "WriteXml" method to write the data to a xml file, I want to map the XSD file I...
13
by: Jerry C | last post by:
I am using some sample code from gotdotnet to Create DataSet mappings from a xsd schema. I am geting this error. code and error below. I might mention there is also a publictypelibrary file with...
1
by: GoogleGroups | last post by:
It seems like this should be easy, but it has proven to be quite painful. I have an existing dataset, which I used the GetChanges and WriteXML functions upon to write out a DiffGram to a local...
2
by: rrflore2 | last post by:
Ok. I'm writing and deleting to an xml file using a dataset. I have a function in my codebehind page that binds a listbox to the dataset that performs the writes/deletes. Everything seems to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.