XmlSchemaValidator.AddSchema(XmlSchema) Method

Definition

Adds an XML Schema Definition Language (XSD) schema to the set of schemas used for validation.

public:
 void AddSchema(System::Xml::Schema::XmlSchema ^ schema);
public void AddSchema (System.Xml.Schema.XmlSchema schema);
member this.AddSchema : System.Xml.Schema.XmlSchema -> unit
Public Sub AddSchema (schema As XmlSchema)

Parameters

schema
XmlSchema

An XmlSchema object to add to the set of schemas used for validation.

Exceptions

The XmlSchema parameter specified is null.

The target namespace of the XmlSchema parameter matches that of any element or attribute already encountered by the XmlSchemaValidator object.

The XmlSchema parameter is invalid.

Remarks

The following are important notes to consider when using the AddSchema method.

  • The AddSchema method can be used to simulate the effect of encountering an inline XML schema in the XML document being validated.

  • The target namespace of the XmlSchema parameter cannot match that of any element or attribute already encountered by the XmlSchemaValidator object.

  • If the ProcessInlineSchema validation option is not set, the AddSchema method does nothing.

Applies to

See also