How to maintain XML element sequence when serializing/deserializing using DataSet

A

Atul Agarwal

If I use the following code

DataSet ds = new DataSet();
ds.ReadXml("input.xml", XmlReadMode.InferSchema);
ds.WriteXml("output.xml");

and provide the following Input.xml
<A>
<C> c1 </C>
<C> c2 </C>
<D> d1 </D>
<E> e1 </E>
<E> e2 </E>
<F> f1 </F>
</A>

the Output.xml contains the following XML in which the elements are
not in the same sequence as in the input XML.
<A>
<D> d1 </D>
<F> f1 </F>
<C> c1 </C>
<C> c2 </C>
<E> e1 </E>
<E> e2 </E>
</A>

I guess this happens because all the columns of a Parent Table are
serialized before the columns of a Child table. Is there any way I can
make the DataSet maintain the input element sequence during
serialization, ie, Children are serialized at their proper "position"
within their Parent ?


Thanks

Atul Agarwal
 
B

Brett Keown [MSFT]

Hi Atul,

Thanks for using the Microsoft Newsgroups. I am researching this issue now
and will reply to you with my findings ASAP.

Thanks for your patience,

Brett Keown
Microsoft Support
(e-mail address removed)

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

Brett Keown [MSFT]

Hi Atul,

Thanks for bringing this bug to our attention. I have confirmed the
behavior you are describing as a bug. While we make every effort to
resolve these types of issues in as expedient a manner as possible, I can
not guarantee when or even if it will be fixed. Thanks again for using the
Microsoft Newsgroups. Please feel free to either post a reply or contact
me directly with any questions you may have.

Brett Keown
Microsoft Support
(e-mail address removed)

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

Top