Serializing classes in C#. nested XML

Posted by Jebli on Stack Overflow See other posts from Stack Overflow or by Jebli
Published on 2010-03-30T09:27:18Z Indexed on 2010/03/30 9:33 UTC
Read the original article Hit count: 399

Filed under:
|
|

Hi All, I have to generate XML in the below format

<objects>
 <items>
<item ="delete">
 <searchfields>
  <searchfield name="itemname" value="itemValue" /> 
  </searchfields>
  </item>
  </items>
  </objects>

So I have generated the CS file using xsd.exe by converting the above XML to XSD.

xsd.exe -c -l:c# -n:XmlSerializationDeleteObject DeleteObject.xsd

The CS file that is generated contains 4 classes.

My question is i have to build the XML in the above mentioned format using the class that is generated. I am able to serialize the class files one by one which retirns one tag at a time, but i am unable to build it in the way that i mentioned above.

Please help

Regardas, jebli

© Stack Overflow or respective owner

Related posts about serialization

Related posts about Xml