Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everybody,
i have a problem with a program that writes an xml file and then it is sended to the customer.
The customer have a system that validate it before read it.
I used the approach with the dataset.

So the problem is :
when I do

dataset.writexml()

the order of nodes don't respect the order of the node written in the xsd file because it write for first the attributes and for second the subnodes.
for example
I was expecting this
XML
-<FatturaElettronicaHeader>
<DatiTrasmissione>
<CedentePrestatore>
<CessionarioCommittente>
<TerzoIntermediarioOSoggettoEmittente>
<SoggettoEmittente>TZ</SoggettoEmittente>
</FatturaElettronicaHeader>

instead of
XML
-<FatturaElettronicaHeader>

<SoggettoEmittente>TZ</SoggettoEmittente>
+<DatiTrasmissione>
+<CedentePrestatore>
+<CessionarioCommittente>
+<TerzoIntermediarioOSoggettoEmittente>


what can i do?
thank you
Posted
Comments
barneyman 24-Sep-15 19:07pm    
couple of observations/questions here ..

1. your xml (both examples) as quoted, are broken - they're not closed - have you simply pasted them incorrectly?
2. are you saying the XSD re-orders it, or the writexml method?
gregorio89 25-Sep-15 3:29am    
1 It's because i pasted it from notepad ++. The nodes are correct.
2 I think it's the write method because if I change the order of the datacolumns and I do writexml I obtain a changed order.
barneyman 27-Sep-15 7:28am    
Macie is right - we need code ...

writexml will honour the structure in the order you add nodes to it
Maciej Los 26-Sep-15 18:43pm    
You did not provide enough information to help you. Some piece of code you're using to export data into xml file would be helpful.

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