hierarchial xml from DataSets

G

GaryDean

I'm writing both client and WebService for data exchange. Rather than using
XMLTextWriters and writing everything in code I'm intending to use multiple
datatables in a dataset and serialize it out to xml because it's much less
code and much less work. I'm able to easily do this but I have one issue...

it's easy to do this:
<datasetname>
<table1stuff>

<table1stuff>

<table2stuff>

<table2stuff>

<table3stuff>

<table3stuff>
<datasetname>
but how can I have hierarchial groupings like putting table2stuff and
table3stuff under a grouping called <lineitems>. that would be like having
a datatable within a datatable and I don't believe that's possible.
 
S

Steven Cheng[MSFT]

Hi Gary,

As for DataSet/DataTables, they have fixed and definite xml serialization
rule, each datatable will be nested with in the DataSet element in
parallel. Only if there is definite master/detail like relation will make
one datatable row include other datatable records.

for your scenario, what does the "lineitems" wrapper group come from, is it
refered to a relation in backend database or just a custom role you
defined? If you want flexible customzation of the serializaed XML format, I
think you need to define custom class and control their xml serialization
through some XML serialization attribute or manually do the xml
serialzation through IXmlSerialization interface.

Please feel free to let me know your actual requirement and scenario.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top