.NET Parsing with Validation in .NET with XmlValidatingReader

The XmlTextReader covered in the previous section is an extremely fast and efficient parser, but it does have the downside of not doing any validation of the XML document. The .NET XML architecture provides a higher-level parser called XmlValidatingReader that provides this functionality. We will investigate the XmlValidatingReader in this section and use it to create an example that checks the validity of a document using a DTD.

The XmlValidatingReader doesn't parse text directly. Instead, it relies on another XmlReader like XmlTextReader for that lower-level functionality. Because we've just covered the XmlTextReader in the last section, that is the parser we'll use for our example. ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.