XmlSchemaSet.Schemas Method

Definition

Returns a collection of XML Schema definition language (XSD) schemas in the XmlSchemaSet.

Overloads

Schemas()

Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet.

Schemas(String)

Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet that belong to the given namespace.

Schemas()

Source:
XmlSchemaSet.cs
Source:
XmlSchemaSet.cs
Source:
XmlSchemaSet.cs

Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet.

public:
 System::Collections::ICollection ^ Schemas();
public System.Collections.ICollection Schemas ();
member this.Schemas : unit -> System.Collections.ICollection
Public Function Schemas () As ICollection

Returns

An ICollection object containing all the schemas that have been added to the XmlSchemaSet. If no schemas have been added to the XmlSchemaSet, an empty ICollection object is returned.

Examples

The following example illustrates how to iterate over all the schemas in the XmlSchemaSet.

Dim schemaSet As XmlSchemaSet = New XmlSchemaSet
schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd")

Dim schema As XmlSchema

For Each schema In schemaSet.Schemas()

    schema.Write(Console.Out)

Next
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd");

foreach (XmlSchema schema in schemaSet.Schemas())
{
    schema.Write(Console.Out);
}

Remarks

This method returns schemas that were added indirectly to the XmlSchemaSet because they were imported.

Note

The Schemas method is the equivalent of the GetEnumerator method of the obsolete XmlSchemaCollection.

Applies to

Schemas(String)

Source:
XmlSchemaSet.cs
Source:
XmlSchemaSet.cs
Source:
XmlSchemaSet.cs

Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet that belong to the given namespace.

public:
 System::Collections::ICollection ^ Schemas(System::String ^ targetNamespace);
public System.Collections.ICollection Schemas (string? targetNamespace);
public System.Collections.ICollection Schemas (string targetNamespace);
member this.Schemas : string -> System.Collections.ICollection
Public Function Schemas (targetNamespace As String) As ICollection

Parameters

targetNamespace
String

The schema targetNamespace property.

Returns

An ICollection object containing all the schemas that have been added to the XmlSchemaSet that belong to the given namespace. If no schemas have been added to the XmlSchemaSet, an empty ICollection object is returned.

Examples

The following example illustrates how to iterate over all the schemas in the http://www.contoso.com/books namespace in the XmlSchemaSet.

Dim schemaSet As XmlSchemaSet = New XmlSchemaSet
schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd")

Dim schema As XmlSchema

For Each schema In schemaSet.Schemas("http://www.contoso.com/books")

    schema.Write(Console.Out)

Next
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd");

foreach (XmlSchema schema in schemaSet.Schemas("http://www.contoso.com/books"))
{
    schema.Write(Console.Out);
}

Remarks

If the targetNamespace parameter is null or Empty, then all schemas without a namespace are returned.

This method returns schemas that were added indirectly to the XmlSchemaSet because they were imported.

Note

The Schemas method is the equivalent of the Item[] method of the obsolete XmlSchemaCollection.

Applies to