How to choose a class for reading and/or writing XML

(taken from http://msdn2.microsoft.com/en-us/library/ms998559.aspx)

 

 

Choose the Appropriate XML Class for the Job

To help you choose the appropriate .NET Framework class to process XML, consider the following guidelines:

·         Use XmlTextReader to process XML data quickly in a forward, read-only manner without using validation, XPath, and XSLT services.

·         Use XmlValidatingReader to process and to validate XML data. Process and validate the XML data in a forward, read-only manner according to an XML schema or a DTD.

·         Use XPathNavigator to obtain read-only, random access to XML data and to use XPath queries. To create an XPathNavigator object over an XML document, you must call the XPathDocument.CreateNavigator method.

·         Use XmlTextWriter to write XML documents. You cannot use XmlTextWriter to update XML documents.

·         Use the XmlTextReader and XmlTextWriter, in combination, for simple transformations rather than resorting to loading an XmlDocument or using XSLT. For example, updating all the price element values in a document can be achieved by reading with the XmlTextReader, updating the value and then writing to the XmlTextWriter, typically by using the WriteNode method.

·         Use the XmlDocument class to update existing XML documents, or to perform XPath queries and updates in combination. To use XPath queries on the XmlDocument, use the Select method.

·         If possible, use client-side XML processing to improve performance and to reduce bandwidth.

posted @ Monday, March 12, 2007 1:23 AM

Print

Comments on this entry:

# re: How to choose a class for reading and/or writing XML

Left by web development company at 8/13/2009 8:14 PM
Gravatar
Nice post,

good thing about this post is, it is not too long and it's easy to read i'm fed up with MSDN website, there for I appriciate your effort to write it

Thanks for writing about it

# to web development company

Left by Angel Eyes at 8/13/2009 10:28 PM
Gravatar
Thank you, I feel the same way about MSDN. I usually Google for articles outside MSDN for an overview and general understanding, before diving into the boring and sometimes hard to read stuff on MSDN.

Your comment:



 (will not be displayed)


 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345