Click here to Skip to main content
15,943,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There's an excellent article here about outputting nested xml but this is not quite my situation (although I may need to take this approach).

I have a fairly complex nested xml structure that I must conform to in order to send data (government thing).

What I'm doing is reading in blank xml shell into a dataset. If I immediately write again, the nesting structure is fine.

The tables are all there after the read and it looks good, but as soon as I add a record, the node is added at the root and the nesting structure is broken. I loop through all the relations and set Nesting = true immediately after reading, but no luck.

The problem is that the structure I need to submit doesn't contain the key fields to set up the "normal" parent-child relationships. Do I need to recreate the relationships and maybe hide them on output? Or is there another way?

Eg:


<school>
<student>
<name>John Smith </name>
</student>
</school>


As soon as I add a record to the student table and write the file, the student node moves down to the school level???
Posted

1 solution

Are you submitting the dataset or the xml? Where are you submitting it to?

I wouldn't worry about making the dataset conform to your xml, in some cases it won't be able to, it wasn't meant to. If you need a specific schema then do it by hand
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900