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

Assembly: System.Xml.ReaderWriter

Inheritance: object → XmlSchemaCollection

Implemented Interfaces

Contains a cache of XML Schema definition language (XSD) and XML-Data Reduced (XDR) schemas. The <see cref="T:System.Xml.Schema.XmlSchemaCollection" /> class is obsolete. Use <see cref="T:System.Xml.Schema.XmlSchemaSet" /> instead.

Properties

public int
Count
Gets the number of namespaces defined in this collection.
public XmlSchema
Item
public XmlNameTable
NameTable
Gets the default <see langword="XmlNameTable" /> used by the <see langword="XmlSchemaCollection" /> when loading new schemas.

Methods

public XmlSchema
Add​(string ns, string uri)
Adds the schema located by the given URL into the schema collection.
Returns The <see cref="T:System.Xml.Schema.XmlSchema" /> added to the schema collection; <see langword="null" /> if the schema being added is an XDR schema or if there are compilation errors in the schema.
ns The namespace URI associated with the schema. For XML Schemas, this will typically be the <see langword="targetNamespace" /> .
uri The URL that specifies the schema to load.
public XmlSchema
Add​(string ns, XmlReader reader)
Adds the schema contained in the <see cref="T:System.Xml.XmlReader" /> to the schema collection.
Returns The <see cref="T:System.Xml.Schema.XmlSchema" /> added to the schema collection; <see langword="null" /> if the schema being added is an XDR schema or if there are compilation errors in the schema.
ns The namespace URI associated with the schema. For XML Schemas, this will typically be the <see langword="targetNamespace" /> .
reader <see cref="T:System.Xml.XmlReader" /> containing the schema to add.
public XmlSchema
Add​(string ns, XmlReader reader, XmlResolver resolver)
Adds the schema contained in the <see cref="T:System.Xml.XmlReader" /> to the schema collection. The specified <see cref="T:System.Xml.XmlResolver" /> is used to resolve any external resources.
Returns The <see cref="T:System.Xml.Schema.XmlSchema" /> added to the schema collection; <see langword="null" /> if the schema being added is an XDR schema or if there are compilation errors in the schema.
ns The namespace URI associated with the schema. For XML Schemas, this will typically be the <see langword="targetNamespace" /> .
reader <see cref="T:System.Xml.XmlReader" /> containing the schema to add.
resolver The <see cref="T:System.Xml.XmlResolver" /> used to resolve namespaces referenced in <see langword="include" /> and <see langword="import" /> elements or <see langword="x-schema" /> attribute (XDR schemas). If this is <see langword="null" /> , external references are not resolved.
public XmlSchema
Add​(XmlSchema schema)
Adds the <see cref="T:System.Xml.Schema.XmlSchema" /> to the collection.
Returns The <see langword="XmlSchema" /> object.
schema The <see langword="XmlSchema" /> to add to the collection.
public XmlSchema
Add​(XmlSchema schema, XmlResolver resolver)
Adds the <see cref="T:System.Xml.Schema.XmlSchema" /> to the collection. The specified <see cref="T:System.Xml.XmlResolver" /> is used to resolve any external references.
Returns The <see langword="XmlSchema" /> added to the schema collection.
schema The <see langword="XmlSchema" /> to add to the collection.
resolver The <see cref="T:System.Xml.XmlResolver" /> used to resolve namespaces referenced in <see langword="include" /> and <see langword="import" /> elements. If this is <see langword="null" /> , external references are not resolved.
public void
Add​(XmlSchemaCollection schema)
Adds all the namespaces defined in the given collection (including their associated schemas) to this collection.
schema The <see langword="XmlSchemaCollection" /> you want to add to this collection.
public bool
Contains​(string ns)
Gets a value indicating whether a schema with the specified namespace is in the collection.
Returns <see langword="true" /> if a schema with the specified namespace is in the collection; otherwise, <see langword="false" /> .
ns The namespace URI associated with the schema. For XML Schemas, this will typically be the target namespace.
public bool
Contains​(XmlSchema schema)
Gets a value indicating whether the <see langword="targetNamespace" /> of the specified <see cref="T:System.Xml.Schema.XmlSchema" /> is in the collection.
Returns <see langword="true" /> if there is a schema in the collection with the same <see langword="targetNamespace" /> ; otherwise, <see langword="false" /> .
schema The <see langword="XmlSchema" /> object.
public void
CopyTo​(XmlSchema[] array, int index)
Copies all the <see langword="XmlSchema" /> objects from this collection into the given array starting at the given index.
array The array to copy the objects to.
index The index in <paramref name="array" /> where copying will begin.
GetEnumerator​()
Provides support for the "for each" style iteration over the collection of schemas.
Returns An enumerator for iterating over all schemas in the current collection.
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