Validating XML Documents

When you deal with XML in your code, you are concerned with two primary processes: reading XML and writing XML. When reading an XML document, you might be concerned about whether the XML that you are consuming is “correct.” That is, is the XML compliant with the W3C XML specification, and does it correctly implement the defined grammar and vocabulary delineated by a DTD, XDR, or XSD document? XML documents that correctly adhere to the XML specification are said to be well formed. XML documents that adhere to the structure described in a schema document are said to be valid.

This section examines the System.Xml support for validating XML documents against a specific schema by using the XmlValidatingReader class.

Creating ...

Get Visual Basic® Programmer's Guide to the .NET Framework Class Library 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.