Problem generating XML from dataset

  • Thread starter Thread starter Mathew Relick
  • Start date Start date
M

Mathew Relick

I need to generate an xml document from several datatables in a
dataset which was loaded from SQL Server. There are several
parent-child relationships between these tables. Thanks to some
previous help here, I'm able to convert the data set into xml with the
child nodes being nested under the parent nodes; but the problem is
that the child nodes contain the parent's primary key values. How can
I get rid of these values or hide them from the get go? Because the
values are being nested, they shouldn't be required (and I don't want
them).

For instance:

If have a two tables Person(PersonID, Name) and Home(HomeID, PersonID,
HomeName), I would like to get a document as follows:

<Person>
<PersonID>12</PersonID>
<Name>Joe</Name>
<Home>
<HomeID>12</HomeID>
<HomeName>Shangrila</HomeName>
</Home>
</Person>

but all I'm able to generate is:

<Person>
<PersonID>12</PersonID>
<Name>Joe</Name>
<Home>
<HomeID>19</HomeID>
<PersonID>12</PersonID>
<HomeName>Shangrila</HomeName>
</Home>
</Person>
 
Back
Top