what is fast way to write xml structure data into xml file?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
we use .NET 4 and we use following code to write xml structure data into xml file, it seems too slow
XDocument doc = new XDocument(CreateLogElement(run));
XmlWriterSettings settings = new XmlWriterSettings();<br/>
settings.NewLineOnAttributes = true;<br/>
settings.Indent = true;
XmlWriter xmlWriter = XmlWriter.Create(filePath, settings);<br/>
doc.WriteTo(xmlWriter);<br/>
xmlWriter.Flush();<br/>
xmlWriter.Close();
Is this fast way to write data into xml file?
Does anybody know how to improve it?
Does anybody know what is different between XDocument and XmlDocument?
We see the following links:
http://blogs.msdn.com/b/codejunkie/archive/2008/10/08/xmldocument-vs-xelement-performance.aspx <span style="color:#0066dd http://blogs.msdn.com/b/codejunkie/archive/2008/10/08/xmldocument-vs-xelement-performance.aspx
thx! <hr class="sig JaneC

View the full article
 
Back
Top