Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: XML Beginner
What is the best way to create an XML document using C#? I'm a newbie with regards to XML and was wanting some guidelines/pointers to get started. Any help would be greatly appreciated.
Posted 12-Sep-12 6:28am
Comments
Wes Aday at 12-Sep-12 11:31am
   
Reading the documentation, http://msdn.microsoft.com/en-us/library/system.xml.aspx, is a good place to start.
Sergey Alexandrovich Kryukov at 12-Sep-12 18:36pm
   
"Best" may means "fastest", "easiest", "most robust", you name it. So, it depends on what you want.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Based on different Scenarios you could use the following:
 
1. XMLSerializer : Assuming you have an object(class) and you need XML respresentation for this.
http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx[^]
 
2. XML Writer: If You are going to create each and every item.
http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx[^]
 
3. Through DataSet's WriteXml method : Assuming you have a dataset already
http://msdn.microsoft.com/en-us/library/hb27k0tf(v=vs.90).aspx[^]
 
4. XMLDocument.Load
If you already have a string/stream/TextReader/XmlReader respresentation of xml.
http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^]
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I would suggest you to go through this: MSDN: Improving XML Performance[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 380
1 OriginalGriff 230
2 DamithSL 220
3 Zoltán Zörgő 170
4 Maciej Los 135
0 OriginalGriff 7,740
1 DamithSL 5,694
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,061
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100