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.​XmlSchema

Assembly: System.Xml.ReaderWriter

Inheritance: object → XmlSchemaObject → XmlSchema

An in-memory representation of an XML Schema, as specified in the World Wide Web Consortium (W3C) XML Schema Part 1: Structures and XML Schema Part 2: Datatypes].

Fields and Constants

public const string
InstanceNamespace
The XML schema instance namespace. This field is constant.
public const string
Namespace
The XML schema namespace. This field is constant.

Properties

public XmlSchemaForm
AttributeFormDefault
Gets or sets the form for attributes declared in the target namespace of the schema.
AttributeGroups
Gets the post-schema-compilation value of all the global attribute groups in the schema.
Attributes
Gets the post-schema-compilation value for all the attributes in the schema.
BlockDefault
Gets or sets the <see langword="blockDefault" /> attribute, which sets the default value of the <see langword="block" /> attribute on element and complex types in the <see langword="targetNamespace" /> of the schema.
public XmlSchemaForm
ElementFormDefault
Gets or sets the form for elements declared in the target namespace of the schema.
Elements
Gets the post-schema-compilation value for all the elements in the schema.
FinalDefault
Gets or sets the <see langword="finalDefault" /> attribute, which sets the default value of the <see langword="final" /> attribute on elements and complex types in the target namespace of the schema.
Groups
Gets the post-schema-compilation value of all the groups in the schema.
public string
Id
Gets or sets the string ID.
Includes
Gets the collection of included and imported schemas.
public bool
IsCompiled
Indicates if the schema has been compiled.
Gets the collection of schema elements in the schema and is used to add new element types at the <see langword="schema" /> element level.
Notations
Gets the post-schema-compilation value for all notations in the schema.
SchemaTypes
Gets the post-schema-compilation value of all schema types in the schema.
public string
TargetNamespace
Gets or sets the Uniform Resource Identifier (URI) of the schema target namespace.
public XmlAttribute[]
UnhandledAttributes
Gets or sets the qualified attributes which do not belong to the schema target namespace.
public string
Version
Gets or sets the version of the schema.
public int
LineNumber
Gets or sets the line number in the file to which the <see langword="schema" /> element refers.
public int
LinePosition
Gets or sets the line position in the file to which the <see langword="schema" /> element refers.
Gets or sets the <see cref="T:System.Xml.Serialization.XmlSerializerNamespaces" /> to use with this schema object.
Parent
Gets or sets the parent of this <see cref="T:System.Xml.Schema.XmlSchemaObject" /> .
public string
SourceUri
Gets or sets the source location for the file that loaded the schema.

Methods

public void
Compile​(ValidationEventHandler validationEventHandler)
Compiles the XML Schema Object Model (SOM) into schema information for validation. Used to check the syntactic and semantic structure of the programmatically built SOM. Semantic validation checking is performed during compilation.
validationEventHandler The validation event handler that receives information about XML Schema validation errors.
public void
Compile​(ValidationEventHandler validationEventHandler, XmlResolver resolver)
Compiles the XML Schema Object Model (SOM) into schema information for validation. Used to check the syntactic and semantic structure of the programmatically built SOM. Semantic validation checking is performed during compilation.
validationEventHandler The validation event handler that receives information about the XML Schema validation errors.
resolver The <see langword="XmlResolver" /> used to resolve namespaces referenced in <see langword="include" /> and <see langword="import" /> elements.
public static XmlSchema
Read​(IO.​Stream stream, ValidationEventHandler validationEventHandler)
Reads an XML Schema from the supplied stream.
Returns The <see cref="T:System.Xml.Schema.XmlSchema" /> object representing the XML Schema.
stream The supplied data stream.
validationEventHandler The validation event handler that receives information about XML Schema syntax errors.
public static XmlSchema
Read​(IO.​TextReader reader, ValidationEventHandler validationEventHandler)
Reads an XML Schema from the supplied <see cref="T:System.IO.TextReader" /> .
Returns The <see cref="T:System.Xml.Schema.XmlSchema" /> object representing the XML Schema.
reader The <see langword="TextReader" /> containing the XML Schema to read.
validationEventHandler The validation event handler that receives information about the XML Schema syntax errors.
public static XmlSchema
Read​(XmlReader reader, ValidationEventHandler validationEventHandler)
Reads an XML Schema from the supplied <see cref="T:System.Xml.XmlReader" /> .
Returns The <see cref="T:System.Xml.Schema.XmlSchema" /> object representing the XML Schema.
reader The <see langword="XmlReader" /> containing the XML Schema to read.
validationEventHandler The validation event handler that receives information about the XML Schema syntax errors.
public void
Write​(IO.​Stream stream)
Writes the XML Schema to the supplied data stream.
stream The supplied data stream.
public void
Write​(IO.​Stream stream, XmlNamespaceManager? namespaceManager)
Writes the XML Schema to the supplied <see cref="T:System.IO.Stream" /> using the <see cref="T:System.Xml.XmlNamespaceManager" /> specified.
stream The supplied data stream.
namespaceManager The <see cref="T:System.Xml.XmlNamespaceManager" /> .
public void
Write​(IO.​TextWriter writer)
Writes the XML Schema to the supplied <see cref="T:System.IO.TextWriter" /> .
writer The <see cref="T:System.IO.TextWriter" /> to write to.
public void
Write​(IO.​TextWriter writer, XmlNamespaceManager? namespaceManager)
Writes the XML Schema to the supplied <see cref="T:System.IO.TextWriter" /> .
writer The <see cref="T:System.IO.TextWriter" /> to write to.
namespaceManager The <see cref="T:System.Xml.XmlNamespaceManager" /> .
public void
Write​(XmlWriter writer)
Writes the XML Schema to the supplied <see cref="T:System.Xml.XmlWriter" /> .
writer The <see cref="T:System.Xml.XmlWriter" /> to write to.
public void
Write​(XmlWriter writer, XmlNamespaceManager? namespaceManager)
Writes the XML Schema to the supplied <see cref="T:System.Xml.XmlWriter" /> .
writer The <see cref="T:System.Xml.XmlWriter" /> to write to.
namespaceManager The <see cref="T:System.Xml.XmlNamespaceManager" /> .
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object