Working with the XmlTextReaderThe XmlTextReader is a fast, forward-only, read-only XML parser. Since the XmlTextReader is a forward-only reader, very little data is cached while parsing the XML stream. This allows for the XmlTextReader to parse a document while using a small footprint. The XmlTextReader does not provide any validation beyond checking the well- formedness of the XML. Since no validation is performed while reading the document, the XmlTextReader provides fast XML parsing. The XmlTextReader throws an XmlException if it encounters an error parsing the XML stream. Although this allows you to catch the exception and continue parsing, this is not recommended. The state of the XmlTextReader is unpredictable after it has thrown an XmlException . The desktop .NET Framework's implementation of the XmlTextReader checks the well-formedness of the DocumentType nodes but does not validate the document using the Document Type Definition (DTD). The .NET Compact Framework enforces an even stricter rule: Documents with DocumentType nodes cannot be processed by the XmlTextReader ; the XmlTextReader will throw an XmlException if it encounters a DocumentType node while parsing. |