473,396 Members | 1,852 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,396 software developers and data experts.

Problem with XMLDataDocument...

I'm relatively new to this sort of thing, so forgive me if this is
completely off base, but I'm having a problem getting the
XMLDataDocument to do what I need it to.

I have a small test application that has a DataSet with two data
tables, Person and Home. I've setup Home as a child of Person. What
I want to do is to load data into these two tables, and then have the
data document create the xml with the child nodes (home) nested under
the parent node (person). Is this possible??? The code snippet I
have to load and output the xml is as follows:

DsTester ds = new DsTester();
DsTester.PersonDataTable pdt =
(DsTester.PersonDataTable)ds.Tables["Person"];
DsTester.HomeDataTable hdt =
(DsTester.HomeDataTable)ds.Tables["Home"];
pdt.AddPersonRow(12,"John");
hdt.AddHomeRow(1,pdt[0], "MyHome");
XmlDataDocument xdoc = new XmlDataDocument(ds);
System.Diagnostics.Debug.WriteLine(xdoc.OuterXml);
What it outputs is:
<DsTester xmlns="http://tempuri.org/Dataset1.xsd">
<Person>
<PersonID>12</PersonID>
<Name>John</Name>
</Person>
<Home>
<HomeID>1</HomeID>
<PersonID>12</PersonID>
<HomeName>MyHome</HomeName>
</Home>
</DsTester>
What I want it to output is:
<DsTester xmlns="http://tempuri.org/Dataset1.xsd">
<Person>
<PersonID>12</PersonID>
<Name>John</Name>
<Home>
<HomeID>1</HomeID>
<HomeName>MyHome</HomeName>
</Home>
</Person>
</DsTester>

Is this possible, or am I going to have to roll my own?
Thanks!!!
Nov 12 '05 #1
0 1151

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

Similar topics

3
by: John R. | last post by:
I have an application written in C# and i am using MS XML DOM! I have a document with the following structure (only the <DicEntry> - Elements are important): <NewDataSet...
1
by: Peter Feakins | last post by:
We're building some web services that are primarily being consumed by a .net application. We're returning datasets for that purpose. We're also have to provide access to these services to classic...
0
by: Raj | last post by:
hi, I associate dataset with one xmldatadocument? how can I disassociate from xmldatadocument, so I can associate with another xmldatadocument. and, how can I remove xmldatadocument from...
1
by: Todd | last post by:
I have the following code that inserts a new element and its attributes into an xml file. The problem is the syntax of the inserted row. here is my code: 'Create an XmlDataDocument. Dim doc As...
1
by: Petr Felzmann | last post by:
Hi, why the duration of call the CloneNode(true) is steadily increasing? First call is 0.004s and 100th is 0.16s! XML file is 5kB only, no disk swap. XmlDataDocument xml = new...
1
by: Derrick | last post by:
I am reading in xml files that equate to sql tables, via XmlDataDocument, and then operating on the DataSet. With the most simple app that just loads the xml doc, I see the memory footprint of the...
0
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
1
by: JD | last post by:
I have a DataGridView with a DataSet as DataSource. The user can update the contents of the DataGridView, and then click on a Save button to save the data to an XML file. When they click on...
3
by: david.juffermans | last post by:
Hi, I have a problem reading xml into a dataset using the XmlDataDocument. In a test project, I created the following xml file: <?xml version="1.0" standalone="yes"?> <Customer>...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.