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!!! 1 1324
Mathew,
I think that you are searching for this information (look at nested) http://msdn.microsoft.com/library/de...arelations.asp
I hope this helps?
Cor
"Mathew Relick" <ti****@yahoo.c om> 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!!! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
by: Jim Bancroft |
last post by:
Hi,
I'm porting a VB 6 app to .Net, and wanted to use an XMLDataDocument to
store information that had previously been kept in XML Recordsets.
Unfortunately, I'm not too familiar yet with .Net's XML Namespace and
was wondering if someone could help with something....in the VB 6
application, we would append two extra nodes to the XMLRecordset-- an error
message, and error number. Then, when it came time to reconstruct the
recordset...
|
by: gilly3 |
last post by:
Reposting to a more relevant group.
I am passing a generic dataset into a new XMLDataDocument and then
parsing the XML with XSLT. The idea being that I can parse any dataset
with the same xslt, and dynamically generate an html table. The problem
is when the DataSet contains a null value, the node for that record is
not created. Then when the xml parses it, there are too few cells in
some of the table rows.
I can think of a couple...
|
by: James Ankrom |
last post by:
Why does this fail?
Dim relResources As New Data.DataRelation("Application_Resources",
..Tables("User_Applications").Columns("Application_id"),
..Tables("Resource_Rights").Columns("Application_id"), False)
mUserData.Relations.Add(relResources)
relResources.Nested = True
Dim UserDataXML As System.Xml.XmlDataDocument = New
System.Xml.XmlDataDocument(mUserData)
|
by: Steven Blair |
last post by:
Hi,
Quick overview of the problem:
public bool Something( out DataSet ds )
{
bool ret=false;
try
{
| |
by: Steve |
last post by:
I have a dataset.
I fill it with two recordsets from SQL queries.
Tables are called tblPlanFYSpendingStage, tblSpendingStage.
|
by: Adrian Meyer |
last post by:
Hi,
On the server I code the following web service:
))]
public XmlDataDocument GetTypedXmlDataDocument()
{
sqlDataAdapter1.Fill(typedDataSet1);
XmlDataDocument dataDoc
|
by: Mathew Relick |
last post by:
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...
|
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...
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |