Sunday, September 17, 2006

.NET XmlReader & XmlWriter

@ XmlReader provides fast, forwar-only, read-only access to XML documents.

@ The primary way for you to create an instance of an XmlReader is by using the Static/Shared Create method. Rather than creating concrete implementattions of the XmlReader calss, you create an instance of the XmlReaderSettings class and pass it to the Create method. You specify the features you want for your XmlReader object with the XmlReaderSettings class.

@ If you’re going to run through the document only once, you don’t want to hold it in memory; youwant the access to be as fast as possible. XmlReader is the right decision in this case.

^ 我倾向于在一个Application中,对于数据操作,XML操作,都分别只使用在一种模式:数据操作使用DataSet;XML操作使用XmlDocument。虽然Reader和Writer的模式有优势,但是并不提供一个完整的解决模型和统一的操作方式。只使用一种“全能”的模式,可以让编程更易于实现和维护。至于内存和性能问题,我想应该通过硬件来解决。