Name
XmlValidatingReader
Synopsis
This class is an XML reader
that
supports DTD and schema validation.
The type of validation to perform is contained in the
ValidationType property, which can be
DTD, Schema,
XDR, or Auto.
Auto is the default and determines which type of
validation is required, if any, based on the document. If the
DOCTYPE element contains DTD information, that is
used. If a schema attribute exists or there is an inline
<schema>, that schema is used.
This class implements an event handler that you can set to warn of
validation errors during Read( ) operations.
Specifically, a delegate instance of type
System.Xml.Schema.ValidationEventHandler can be
set for the ValidationEventHandler event in this
class. This delegate instance is invoked whenever the
XmlValidatingReader finds an schema-invalid
construct in the XML document it is reading, giving the delegate a
chance to perform whatever error-handling is appropriate. If no event
handler is registered, an XmlException is thrown
instead on the first error.
public class XmlValidatingReader: XmlReader, IXmlLineInfo { // Public Constructors public XmlValidatingReader(System.IO.StreamxmlFragment, XmlNodeTypefragType, XmlParserContextcontext); public XmlValidatingReader(stringxmlFragment, XmlNodeTypefragType, XmlParserContextcontext); public XmlValidatingReader(XmlReaderreader); // Public Instance Properties public override int AttributeCount{get; } // overrides XmlReader public override string BaseURI{get; } // overrides ...