XmlSchemaValidator.XmlSchemaValidator Constructor

Initializes a new instance of the XmlSchemaValidator class.

Namespace: System.Xml.Schema
Assembly: System.Xml (in system.xml.dll)

public XmlSchemaValidator (
	XmlNameTable nameTable,
	XmlSchemaSet schemas,
	IXmlNamespaceResolver namespaceResolver,
	XmlSchemaValidationFlags validationFlags
)
public XmlSchemaValidator (
	XmlNameTable nameTable, 
	XmlSchemaSet schemas, 
	IXmlNamespaceResolver namespaceResolver, 
	XmlSchemaValidationFlags validationFlags
)
public function XmlSchemaValidator (
	nameTable : XmlNameTable, 
	schemas : XmlSchemaSet, 
	namespaceResolver : IXmlNamespaceResolver, 
	validationFlags : XmlSchemaValidationFlags
)
Not applicable.

Parameters

nameTable

An XmlNameTable object containing element and attribute names as atomized strings.

schemas

An XmlSchemaSet object containing the XML Schema Definition Language (XSD) schemas used for validation.

namespaceResolver

An IXmlNamespaceResolver object used for resolving namespaces encountered during validation.

validationFlags

An XmlSchemaValidationFlags value specifying schema validation options.

Exception typeCondition

ArgumentNullException

One or more of the parameters specified are a null reference (Nothing in Visual Basic).

XmlSchemaException

An error occurred while compiling schemas in the XmlSchemaSet parameter.

The following are important notes to consider when using the XmlSchemaValidator constructor.

  • The contents of the XmlSchemaSet parameter are copied into an internal XmlSchemaSet object when the ProcessInlineSchema or the ProcessSchemaLocation validation options are set. As a result, changes to the input XmlSchemaSet object during validation do not affect the outcome of validation.

  • If the XmlSchemaSet parameter specified is not compiled, its Compile method is called.

  • The IXmlNamespaceResolver parameter is especially important for validating xs:QName types. The XmlSchemaValidator class does not copy the in-scope namespaces from the IXmlNamespaceResolver object but instead holds a reference to it. This allows new namespaces to be added to the IXmlNamespaceResolver object during the validation process.

Security noteSecurity Note:

The ProcessInlineSchema and ProcessSchemaLocation validation flags of an XmlSchemaValidator object are not set be default. Additionally, the XmlResolver property of an XmlSchemaValidator object is a null reference (Nothing in Visual Basic) by default. As a result, external schemas referenced in include, imports, or redefine elements are not resolved by default.

For an example of the XmlSchemaValidator constructor, see the XmlSchemaValidator class reference topic.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0
Show: