編集

次の方法で共有


XmlValidatingReader.ValidationEventHandler Event

Definition

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.

public:
 event System::Xml::Schema::ValidationEventHandler ^ ValidationEventHandler;
public event System.Xml.Schema.ValidationEventHandler ValidationEventHandler;
member this.ValidationEventHandler : System.Xml.Schema.ValidationEventHandler 

Event Type

Remarks

Note

The XmlValidatingReader class is obsolete in .NET Framework 2.0. You can create a validating XmlReader instance by using the XmlReaderSettings class and the Create method. For more information, see the Remarks section of the XmlReader reference page.

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

If no event handler is provided, an 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 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.

Applies to

See also