473,804 Members | 3,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

nested xml from dataset

tom
hello,

i have seen multiple postings on the subject but no answer that
addresses my question:

I create a dataset using a xsd schema. the schema specifies a relation
from one of the tables to the other table via a primary-secondary key
on the tables.

i load the data into the dataset.
i show the data in a datagrid and i see that the relation worked
because the data of the second table is attached to the data of the
first table.

when i then write out the xml with a:

m_DynamicDatase t.WriteXml("c:\ \tomstest1.xml" ,XmlWriteMode.W riteSchema);

i first see all the entries for the first table like :

<T_APP>
<ID_APP>2003061 7190066793418</ID_APP>
<CD_TYP_APP>TER MC</CD_TYP_APP>
<AM_APP>111</AM_APP>
</T_APP>
<T_APP>
<ID_APP>2003061 7220066793204</ID_APP>
<CD_TYP_APP>TER MC</CD_TYP_APP>
<AM_APP>111</AM_APP>
</T_APP>
..... etc..

and then all the data from the second table

<T_PARTY>
<ID_APP>2003061 7190066793418</ID_APP>
<ID_PARTY>6</ID_PARTY>
<CD_ROLE_PARTY> OTHER</CD_ROLE_PARTY>
<CD_TYP_PARTY>O THER</CD_TYP_PARTY>
</T_PARTY>
<T_PARTY>
<ID_APP>2003061 7220066793204</ID_APP>
<ID_PARTY>1</ID_PARTY>
<CD_ROLE_PARTY> PrimeBrwer</CD_ROLE_PARTY>
<CD_TYP_PARTY>A PLCNT</CD_TYP_PARTY>
</T_PARTY>

is there a way that i can specify that the T_PARTY xml-sections need
to be 'under' the T_APP sections ?
do i need to change my schema for that ? or do i need to do this
programatically ?
-------------- schema follows ----------------

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Dataset1"
targetNamespace ="http://tempuri.org/Dataset1.xsd"
elementFormDefa ult="qualified" attributeFormDe fault="qualifie d"
xmlns="http://tempuri.org/Dataset1.xsd"
xmlns:mstns="ht tp://tempuri.org/Dataset1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="u rn:schemas-microsoft-com:xml-msdata">
<xs:element name="Dataset1" msdata:IsDataSe t="true">
<xs:complexType >
<xs:choice maxOccurs="unbo unded">
<xs:element name="T_APP">
<xs:complexType >
<xs:sequence>
<xs:element name="ID_APP" type="xs:string " />
<xs:element name="CD_TYP_AP P" type="xs:string " />
<xs:element name="AM_APP" type="xs:decima l" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="T_PARTY">
<xs:complexType >
<xs:sequence>
<xs:element name="ID_APP" type="xs:string " />
<xs:element name="ID_PARTY" type="xs:string " />
<xs:element name="CD_ROLE_P ARTY" type="xs:string " />
<xs:element name="CD_TYP_PA RTY" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Dataset1K ey1" msdata:PrimaryK ey="true">
<xs:selector xpath=".//mstns:T_APP" />
<xs:field xpath="mstns:ID _APP" />
</xs:unique>
<xs:unique name="Dataset1K ey2" msdata:PrimaryK ey="true">
<xs:selector xpath=".//mstns:T_PARTY" />
<xs:field xpath="mstns:ID _APP" />
<xs:field xpath="mstns:ID _PARTY" />
</xs:unique>
<xs:keyref name="T_APPT_PA RTY" refer="Dataset1 Key1"
msdata:IsNested ="true">
<xs:selector xpath=".//mstns:T_PARTY" />
<xs:field xpath="mstns:ID _APP" />
</xs:keyref>
</xs:element>
</xs:schema>

------------ end schema -----------------------
Nov 11 '05 #1
1 6607
If I understood right specify the DataRelation's, that you should have in
the DataSet between these Tables, Nested property to True.

--
Teemu Keiski
MCP,Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com

Email:
jo****@aspallia nce.com
"tom" <to**********@b aycorpadvantage .com> kirjoitti viestissä
news:bc******** *************** ***@posting.goo gle.com...
hello,

i have seen multiple postings on the subject but no answer that
addresses my question:

I create a dataset using a xsd schema. the schema specifies a relation
from one of the tables to the other table via a primary-secondary key
on the tables.

i load the data into the dataset.
i show the data in a datagrid and i see that the relation worked
because the data of the second table is attached to the data of the
first table.

when i then write out the xml with a:

m_DynamicDatase t.WriteXml("c:\ \tomstest1.xml" ,XmlWriteMode.W riteSchema);

i first see all the entries for the first table like :

<T_APP>
<ID_APP>2003061 7190066793418</ID_APP>
<CD_TYP_APP>TER MC</CD_TYP_APP>
<AM_APP>111</AM_APP>
</T_APP>
<T_APP>
<ID_APP>2003061 7220066793204</ID_APP>
<CD_TYP_APP>TER MC</CD_TYP_APP>
<AM_APP>111</AM_APP>
</T_APP>
..... etc..

and then all the data from the second table

<T_PARTY>
<ID_APP>2003061 7190066793418</ID_APP>
<ID_PARTY>6</ID_PARTY>
<CD_ROLE_PARTY> OTHER</CD_ROLE_PARTY>
<CD_TYP_PARTY>O THER</CD_TYP_PARTY>
</T_PARTY>
<T_PARTY>
<ID_APP>2003061 7220066793204</ID_APP>
<ID_PARTY>1</ID_PARTY>
<CD_ROLE_PARTY> PrimeBrwer</CD_ROLE_PARTY>
<CD_TYP_PARTY>A PLCNT</CD_TYP_PARTY>
</T_PARTY>

is there a way that i can specify that the T_PARTY xml-sections need
to be 'under' the T_APP sections ?
do i need to change my schema for that ? or do i need to do this
programatically ?
-------------- schema follows ----------------

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Dataset1"
targetNamespace ="http://tempuri.org/Dataset1.xsd"
elementFormDefa ult="qualified" attributeFormDe fault="qualifie d"
xmlns="http://tempuri.org/Dataset1.xsd"
xmlns:mstns="ht tp://tempuri.org/Dataset1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="u rn:schemas-microsoft-com:xml-msdata">
<xs:element name="Dataset1" msdata:IsDataSe t="true">
<xs:complexType >
<xs:choice maxOccurs="unbo unded">
<xs:element name="T_APP">
<xs:complexType >
<xs:sequence>
<xs:element name="ID_APP" type="xs:string " />
<xs:element name="CD_TYP_AP P" type="xs:string " />
<xs:element name="AM_APP" type="xs:decima l" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="T_PARTY">
<xs:complexType >
<xs:sequence>
<xs:element name="ID_APP" type="xs:string " />
<xs:element name="ID_PARTY" type="xs:string " />
<xs:element name="CD_ROLE_P ARTY" type="xs:string " />
<xs:element name="CD_TYP_PA RTY" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Dataset1K ey1" msdata:PrimaryK ey="true">
<xs:selector xpath=".//mstns:T_APP" />
<xs:field xpath="mstns:ID _APP" />
</xs:unique>
<xs:unique name="Dataset1K ey2" msdata:PrimaryK ey="true">
<xs:selector xpath=".//mstns:T_PARTY" />
<xs:field xpath="mstns:ID _APP" />
<xs:field xpath="mstns:ID _PARTY" />
</xs:unique>
<xs:keyref name="T_APPT_PA RTY" refer="Dataset1 Key1"
msdata:IsNested ="true">
<xs:selector xpath=".//mstns:T_PARTY" />
<xs:field xpath="mstns:ID _APP" />
</xs:keyref>
</xs:element>
</xs:schema>

------------ end schema -----------------------

Nov 11 '05 #2

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

Similar topics

0
2055
by: Chi | last post by:
This is a problem that has been nagging me for a while, and I cannot figure out how to best solve the problem: I have a stored procedure that returns multi-level "nested" XML and inline XDR. My goal is to have a .NET application read the XML into a DataSet using the inline schema, and the relations automatically created according to the nesting of the elements. My query in the stored procedure looks similar to this:
2
3905
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)
3
5443
by: Duncan Welch | last post by:
I have a strongly typed dataset that returns two tables - "items" and "itemdetails". In the strongly-typed dataset designer, I've created a link (relationship) between the two tables based on a foreign key. I want to put them into a nested repeater, but I'm having problems finding a "nice" way of doing it. Can someone please point me in the direction of a tutorial or best practice to achieve this?
4
1653
by: Steve Klett | last post by:
(I posted this in ADO group, but I think this group will be better) Hi- I need to develop an FAQ section for our website. We would like to break up the FAQ by products, then categories with each category having n question/answer pairs. I would like to pass parameters in the querystring based on what the product/category the user selected, then populate a datagrid with the correct set of question/answer
0
1447
by: George Durzi | last post by:
I have a DataSet with 3 tables, and two DataRelations dsSubs.Tables.TableName = "Subscriptions" dsSubs.Tables.TableName = "AccountManagers" dsSubs.Relations.Add "AccountManagers_Subscriptions", dsSubs.Tables.Columns dsSubs.Tables.Columns) dsSubs.Tables.TableName = "NewsFeeds"
1
2081
by: Thu | last post by:
Hi, I create a Dataset to link three tables in my Access database. E.g. The three tables are , , . I then create 2 DataRelations, 1st relation (Order_Cust_Rel) links and using CustomerID field that exists in both tables and 2nd relation (Order_Product_Rel) links and using ProductID field. I set the nested property of the relations to True so that the output will be nested. I then use WriteXML to output the dataset to a StreamWriter.
0
1119
by: Ido Flatow | last post by:
As it seems, if I define a nested class in the WS, the client that references the WS get's a generated code where the nested class is defined outside the class. I can say - "Ok, I'll play along" but ... When I create a dataset in the WS, the generated Typed dataset classes define the datatables as nested classes of the dataset - somehow, the generated code on the client knows that they are nested (that's what happens when you let MS...
5
2988
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML document into a text document with a single row for each parent node (that has all of the values from all of the child nodes for that row) The DataView within VS 2005 IDE displays my 15 or so child tables - and knows that some parent rows...
4
1689
by: LW | last post by:
Hi! I have a DataSet and a class in my Web Service. My output for example is: <OrderInfo> <CustomerID>VINET</CustomerID> <OrderID>10248</OrderID> <OrderDate>07/07/1996</OrderDate> <ShippedDate>08/08/1996</ShippedDate>
2
2436
by: th3dude | last post by:
I am trying to pull out some nested XML using C# and XMLReader. Can't seem to extract the "Items" for each "Product" when i loop through file, i can loop over the "Product" notes just fine but everytime i perform a nested loop over the "Items" list i keep every item on the file listed for each "Product". Is there an easy approach to get the related Items for each Product ID instead of all the Items everytime?
0
9575
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,...
0
10564
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
10320
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
10308
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,...
1
7609
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
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
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
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
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.