473,804 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Person DataTable pdt =
(DsTester.Perso nDataTable)ds.T ables["Person"];
DsTester.HomeDa taTable hdt =
(DsTester.HomeD ataTable)ds.Tab les["Home"];
pdt.AddPersonRo w(12,"John");
hdt.AddHomeRow( 1,pdt[0], "MyHome");
XmlDataDocument xdoc = new XmlDataDocument (ds);
System.Diagnost ics.Debug.Write Line(xdoc.Outer Xml);
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>MyHom e</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>MyHom e</HomeName>
</Home>
</Person>
</DsTester>

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

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

Similar topics

3
6063
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 xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance">
1
3536
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 asp pages. To do this we're returning a XmlDataDocument ie Public Function GetDataAsXml(...) return new XmlDataDocument(GetDataAsDataSet) End Function
0
1319
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 memory? I am new to xml. any suggetions would be highly appretiated.
1
1408
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 XmlDataDocument = New XmlDataDocument 'Load the schema. doc.DataSet.ReadXmlSchema("c:\animal.xsd") Dim dtAnimals As DataTable = doc.DataSet.Tables.Item("animal") 'Load the XML data. Dim reader As XmlTextReader = New XmlTextReader("c:\animal.xml")
1
1264
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 XmlDataDocument(); xml.Load(@"C:\foo.xml"); for(int i = 0; i < 100; i++) { XmlNode node = xml.CloneNode(true);
1
416
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 app grow to roughly 5x the size of the xml document after the xml doc is read. Can anyone comment on this? Is this expected? Below are two samples, the first hits northwind, and creates a 19meg (roughly, on my machine) xml file. The second...
0
1431
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
1
2885
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 Save, I call the subroutine below. The first time that I call it, it works fine. However, if the user makes some more changes in the DataGridView and then wants to save again, I get the following error message: "DataSet can be associated with at...
3
4357
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> <OrderDetails> <OrderID>5</OrderID> <ProductID>6</ProductID>
0
9705
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10568
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10311
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.