Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Xml.​Schema.​XmlSchemaValidator
Assembly: System.Xml.ReaderWriter
Inheritance: object → XmlSchemaValidator
Represents an XML Schema Definition Language (XSD) Schema validation engine. The <see cref="T:System.Xml.Schema.XmlSchemaValidator" /> class cannot be inherited.
Properties
public
IXmlLineInfo
LineInfoProvider
Gets or sets the line number information for the XML node being validated.
public
Uri
SourceUri
Gets or sets the source URI for the XML node being validated.
public
object
ValidationEventSender
Gets or sets the object sent as the sender object of a validation event.
public
XmlResolver
XmlResolver
Sets the <see cref="T:System.Xml.XmlResolver" /> object used to resolve <c>xs:import</c> and <c>xs:include</c> elements as well as <c>xsi:schemaLocation</c> and <c>xsi:noNamespaceSchemaLocation</c> attributes.
Methods
public
void
AddSchema​(XmlSchema schema)
Adds an XML Schema Definition Language (XSD) schema to the set of schemas used for validation.
schema
An <see cref="T:System.Xml.Schema.XmlSchema" /> object to add to the set of schemas used for validation.
public
void
EndValidation​()
Ends validation and checks identity constraints for the entire XML document.
public
XmlSchemaAttribute[]
GetExpectedAttributes​()
Returns the expected attributes for the current element context.
Returns An array of <see cref="T:System.Xml.Schema.XmlSchemaAttribute" /> objects or an empty array if there are no expected attributes.
public
XmlSchemaParticle[]
GetExpectedParticles​()
Returns the expected particles in the current element context.
Returns An array of <see cref="T:System.Xml.Schema.XmlSchemaParticle" /> objects or an empty array if there are no expected particles.
public
void
GetUnspecifiedDefaultAttributes​(Collections.​ArrayList defaultAttributes)
Validates identity constraints on the default attributes and populates the <see cref="T:System.Collections.ArrayList" /> specified with <see cref="T:System.Xml.Schema.XmlSchemaAttribute" /> objects for any attributes with default values that have not been previously validated using the <see cref="Overload:System.Xml.Schema.XmlSchemaValidator.ValidateAttribute" /> method in the element context.
defaultAttributes
An <see cref="T:System.Collections.ArrayList" /> to populate with <see cref="T:System.Xml.Schema.XmlSchemaAttribute" /> objects for any attributes not yet encountered during validation in the element context.
public
void
Initialize​()
Initializes the state of the <see cref="T:System.Xml.Schema.XmlSchemaValidator" /> object.
public
void
Initialize​(XmlSchemaObject partialValidationType)
Initializes the state of the <see cref="T:System.Xml.Schema.XmlSchemaValidator" /> object using the <see cref="T:System.Xml.Schema.XmlSchemaObject" /> specified for partial validation.
partialValidationType
An <see cref="T:System.Xml.Schema.XmlSchemaElement" /> , <see cref="T:System.Xml.Schema.XmlSchemaAttribute" /> , or <see cref="T:System.Xml.Schema.XmlSchemaType" /> object used to initialize the validation context of the <see cref="T:System.Xml.Schema.XmlSchemaValidator" /> object for partial validation.
public
void
SkipToEndElement​(XmlSchemaInfo schemaInfo)
Skips validation of the current element content and prepares the <see cref="T:System.Xml.Schema.XmlSchemaValidator" /> object to validate content in the parent element's context.
schemaInfo
An <see cref="T:System.Xml.Schema.XmlSchemaInfo" /> object whose properties are set if the current element content is successfully skipped. This parameter can be <see langword="null" /> .
public
object
ValidateAttribute​(string localName,
string namespaceUri,
string attributeValue,
XmlSchemaInfo? schemaInfo)
Validates the attribute name, namespace URI, and value in the current element context.
Returns The validated attribute's value.
localName
The local name of the attribute to validate.
namespaceUri
The namespace URI of the attribute to validate.
attributeValue
The value of the attribute to validate.
schemaInfo
An <see cref="T:System.Xml.Schema.XmlSchemaInfo" /> object whose properties are set on successful validation of the attribute. This parameter can be <see langword="null" /> .
public
object
ValidateAttribute​(string localName,
string namespaceUri,
XmlValueGetter attributeValue,
XmlSchemaInfo? schemaInfo)
Validates the attribute name, namespace URI, and value in the current element context.
Returns The validated attribute's value.
localName
The local name of the attribute to validate.
namespaceUri
The namespace URI of the attribute to validate.
attributeValue
An <see cref="T:System.Xml.Schema.XmlValueGetter" /> <see langword="delegate" /> used to pass the attribute's value as a Common Language Runtime (CLR) type compatible with the XML Schema Definition Language (XSD) type of the attribute.
schemaInfo
An <see cref="T:System.Xml.Schema.XmlSchemaInfo" /> object whose properties are set on successful validation of the attribute. This parameter and can be <see langword="null" /> .
public
void
ValidateElement​(string localName,
string namespaceUri,
XmlSchemaInfo? schemaInfo)
Validates the element in the current context.
localName
The local name of the element to validate.
namespaceUri
The namespace URI of the element to validate.
schemaInfo
An <see cref="T:System.Xml.Schema.XmlSchemaInfo" /> object whose properties are set on successful validation of the element's name. This parameter can be <see langword="null" /> .
public
void
ValidateElement​(string localName,
string namespaceUri,
XmlSchemaInfo schemaInfo,
string xsiType,
string xsiNil,
string xsiSchemaLocation,
string xsiNoNamespaceSchemaLocation)
Validates the element in the current context with the <c>xsi:Type</c> , <c>xsi:Nil</c> , <c>xsi:SchemaLocation</c> , and <c>xsi:NoNamespaceSchemaLocation</c> attribute values specified.
localName
The local name of the element to validate.
namespaceUri
The namespace URI of the element to validate.
schemaInfo
An <see cref="T:System.Xml.Schema.XmlSchemaInfo" /> object whose properties are set on successful validation of the element's name. This parameter can be <see langword="null" /> .
xsiType
The <c>xsi:Type</c> attribute value of the element. This parameter can be <see langword="null" /> .
xsiNil
The <c>xsi:Nil</c> attribute value of the element. This parameter can be <see langword="null" /> .
xsiSchemaLocation
The <c>xsi:SchemaLocation</c> attribute value of the element. This parameter can be <see langword="null" /> .
xsiNoNamespaceSchemaLocation
The <c>xsi:NoNamespaceSchemaLocation</c> attribute value of the element. This parameter can be <see langword="null" /> .
public
object
ValidateEndElement​(XmlSchemaInfo schemaInfo)
Verifies if the text content of the element is valid according to its data type for elements with simple content, and verifies if the content of the current element is complete for elements with complex content.
Returns The parsed, typed text value of the element if the element has simple content.
schemaInfo
An <see cref="T:System.Xml.Schema.XmlSchemaInfo" /> object whose properties are set on successful validation of the element. This parameter can be <see langword="null" /> .
public
object
ValidateEndElement​(XmlSchemaInfo schemaInfo,
object typedValue)
Verifies if the text content of the element specified is valid according to its data type.
Returns The parsed, typed simple content of the element.
schemaInfo
An <see cref="T:System.Xml.Schema.XmlSchemaInfo" /> object whose properties are set on successful validation of the text content of the element. This parameter can be <see langword="null" /> .
typedValue
The typed text content of the element.
public
void
ValidateEndOfAttributes​(XmlSchemaInfo schemaInfo)
Verifies whether all the required attributes in the element context are present and prepares the <see cref="T:System.Xml.Schema.XmlSchemaValidator" /> object to validate the child content of the element.
schemaInfo
An <see cref="T:System.Xml.Schema.XmlSchemaInfo" /> object whose properties are set on successful verification that all the required attributes in the element context are present. This parameter can be <see langword="null" /> .
public
void
ValidateText​(string elementValue)
Validates whether the text <see langword="string" /> specified is allowed in the current element context, and accumulates the text for validation if the current element has simple content.
elementValue
A text <see langword="string" /> to validate in the current element context.
public
void
ValidateText​(XmlValueGetter elementValue)
Validates whether the text returned by the <see cref="T:System.Xml.Schema.XmlValueGetter" /> object specified is allowed in the current element context, and accumulates the text for validation if the current element has simple content.
elementValue
An <see cref="T:System.Xml.Schema.XmlValueGetter" /> <see langword="delegate" /> used to pass the text value as a Common Language Runtime (CLR) type compatible with the XML Schema Definition Language (XSD) type of the attribute.
public
void
ValidateWhitespace​(string elementValue)
Validates whether the white space in the <see langword="string" /> specified is allowed in the current element context, and accumulates the white space for validation if the current element has simple content.
elementValue
A white space <see langword="string" /> to validate in the current element context.
public
void
ValidateWhitespace​(XmlValueGetter elementValue)
Validates whether the white space returned by the <see cref="T:System.Xml.Schema.XmlValueGetter" /> object specified is allowed in the current element context, and accumulates the white space for validation if the current element has simple content.
elementValue
An <see cref="T:System.Xml.Schema.XmlValueGetter" /> <see langword="delegate" /> used to pass the white space value as a Common Language Runtime (CLR) type compatible with the XML Schema Definition Language (XSD) type of the attribute.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object