Click here to Skip to main content
15,040,743 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai,
I am a beginner in XML.Can anybody tell me that how to create a Dymanic XML with StringBuilder in asp.net(C#)?

Thanks in advance
Posted
Comments
Sandeep Mewara 11-May-11 6:01am
   
Tried anything? Google?
Sandeep Mewara 12-May-11 2:10am
   
Why undo the accepted answer? It was right as much I think! :confused:

   
Comments
Sergey Alexandrovich Kryukov 11-May-11 13:32pm
   
This is good if OP really want to use StringBuilder which I doubt. Bad idea.
My 5 for this answer (and especially for mentioning XmlWriter).

I list all options and do not recommend StringBuilder. Please see my solution.
--SA
Don't do it with stream builder!

You should better use System.Xml.XmlDataDocument (the simplest, good for not very big documents) or System.Xml.Linq.XDocument (apparently good to work with LinQ).

Event better to create your own dynamic data model in memory and translate it to XML eventually, at once using System.Xml.XmlWriter or one of the derived classes. Finally, it's even better to serialize your model; the best way to do this is using Data Contract.

—SA
   
Comments
Sandeep Mewara 12-May-11 0:54am
   
Ok. 5 SA! :)
   
Thank you, Sandeep.
--SA
Kim Togo 12-May-11 5:12am
   
My 5 for XDocument and LINQ. It is quit easy to work with XDocument, XElement etc..
   
Did I advice that? :-) Oh yes, I did. Thank you, Kim.
--SA

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