System.Xml.XmlValidatingReader.ValidationEventHandler Event

Sets an event handler for receiving information about document type definition (DTD), XML-Data Reduced (XDR) schema, and XML Schema definition language (XSD) schema validation errors.

Syntax

public event System.Xml.Schema.ValidationEventHandler ValidationEventHandler

Remarks

Note:

The System.Xml.XmlValidatingReader class is obsolete in dnprdnext. You can create a validating System.Xml.XmlReader instance by using the System.Xml.XmlReaderSettings class and the erload:System.Xml.XmlReader.Create method. For more information, see Validating XML Data with XmlReader.

These events occur during XmlValidatingReader.Read and only if a XmlValidatingReader.ValidationType of DTD, XDR, Schema, or Auto is specified.

If no event handler is provided, an System.Xml.XmlException is thrown on the first validation error (Severity is equal to XmlSeverityType.Error).

Note:

If an element reports a validation error, the rest of the content model for that element is not validated, however, its children are validated. The reader only reports the first error for a given element.

The callback handler can use the System.Xml.Schema.ValidationEventArgs.Severity property to guarantee that an XML instance document is validated against a schema. The Severity property allows you to distinguish between validation errors (Severity is equal to XmlSeverityType.Error) that indicate a fatal error, and validation warnings (Severity is equal to XmlSeverityType.Warning) that indicate that no schema information is available.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0