PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Change XML element sequence
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Change XML element sequence
![]() |
Change XML element sequence |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Can anyone help me please..
I am using vb.net to WriteXML from Ms Access tables to an output stream. Basically, I retrieve data from 3 tables then use DataRelations to link these three tables, set the Nested property of these DataRelations to True so that in the the output XML document, the child node would be nested within the parent node. Dim DS as DataSet Dim Relation_1 As DataRelation = DS.Relations.Add ("Relation_1", DS.Tables("Table_1").Columns("ID_1"), DS.Tables("Table_2").Columns("ID_1")) Relation_1.Nested = True Dim Relation_2 As DataRelation = DS.Relations.Add ("Relation_2", DS.Tables("Table_2").Columns("ID_2"), DS.Tables("Table_3").Columns("ID_2")) Relation_2.Nested = True Dim filename As String = "c:\XmlFile.xml" Dim xmlSW As StreamWriter = New StreamWriter(filename, True) DS.WriteXml(xmlSW) By default, the XML document will display one table after another, i.e. the second table would be displayed at the end of the first table & so on. (1) <Table_1> (2) <Table_1.Column(0)> (3) <ID_1> (4) <Table_1.Column(2)> (5) <Table_1.Column(3)> (6) <Table_2> (7) <ID_1> (8) <Table_2.Column(1)> (9) <ID_2> (10) <Table_2.Column(3)> (11) </Table_2> (12) <Table_3> (13) <ID_2> (14) <Table_3.Column(1)> (15) <Table_3.Column(2)> (16) </Table_3> (17) </Table_1> But I need the second table to be displayed where the ID links. I.e. Instead of <Table_2> node displayed at line(6), I need the entire <Table_2> node displays at line (3). Instead of <Table_3> node displayed at line(12), I need the entire <Table_3> node displays at line (9). I also need to hide all the LinkID, i.e. <ID_1>, <ID_2>. It should look something like this: (1) <Table_1> (2) <Table_1.Column(0)> (6) <Table_2> (8) <Table_2.Column(1)> (12) <Table_3> (14) <Table_3.Column(1)> (15) <Table_3.Column(2)> (16) </Table_3> (10) <Table_2.Column(3)> (11) </Table_2> (4) <Table_1.Column(2)> (5) <Table_1.Column(3)> (17) </Table_1> Does anyone know how to achieve this? Please help me.. thanks. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

