Dataset rearranges my XML

G

Guest

I take a piece of XML like the followin

<CategoryInfo><PropertyCollection><Property key="name" value="New"/></PropertyCollection><Version major="1" minor="0"/></CategoryIfno

I load it into a dataset using any number of methods (reading from a file, from a string, from an xmldocument, etc.) and, without doing anything in the dataset immediately write the data back out to debug. For some unknown reason the dataset always moves my elements around so that the <Version> element is above the <PropertyCollection> element. Normally this would not matter but I am attempting to create XML the is imported into a system that I did not write and have no control over. They are still using DTDs and the DTD rejects XML in which the <Version> tag is above the <PropertyCollection> tab. I have tried many, many things to fix this but there seems to be no way around it. Any help would be greatly appreciated

Thanks
JC
 
Y

Y. Sivaram

Hi there,

I saved your XML data in to the root directory of the device as data.xml
(after fixing the CategoryInfo spelling of the closing tag) and used the
following code

Dim x As New DataSet
x.ReadXml("\data.xml")
x.WriteXml("\data1.xml")

The data1.xml has the same structure and order as data.xml.

If you could post some of your code it would be helpful.

--
Best Regards,
Y. Sivaram

Email:
(e-mail address removed)

jcraven said:
I take a piece of XML like the following

<CategoryInfo><PropertyCollection><Property key="name"
value="New"/> said:
I load it into a dataset using any number of methods (reading from a file,
from a string, from an xmldocument, etc.) and, without doing anything in the
dataset immediately write the data back out to debug. For some unknown
reason the dataset always moves my elements around so that the <Version>
element is above the <PropertyCollection> element. Normally this would not
matter but I am attempting to create XML the is imported into a system that
I did not write and have no control over. They are still using DTDs and the
DTD rejects XML in which the <Version> tag is above the <PropertyCollection>
tab. I have tried many, many things to fix this but there seems to be no
way around it. Any help would be greatly appreciated.
 

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