XmlSchemaSet.Schemas 方法

定義

傳回 XmlSchemaSet 中 XML 結構描述定義語言 (XSD) 結構描述的集合。

多載

Schemas()

傳回 XmlSchemaSet 中所有 XML 結構描述定義語言 (XSD) 結構描述的集合。

Schemas(String)

傳回 XmlSchemaSet 中屬於指定命名空間之所有 XML 結構描述定義語言 (XSD) 結構描述的集合。

Schemas()

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

傳回 XmlSchemaSet 中所有 XML 結構描述定義語言 (XSD) 結構描述的集合。

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

傳回

ICollection 物件,包含已加入至 XmlSchemaSet 的所有結構描述。 如果結構描述尚未加入至 XmlSchemaSet,則會傳回空的 ICollection 物件。

範例

下列範例說明如何逐一查看 中的所有 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);
}

備註

這個方法會傳回間接新增至 的 XmlSchemaSet 架構,因為它們已匯入。

注意

方法 Schemas 相當於 GetEnumerator 過時 XmlSchemaCollection 的 方法。

適用於

Schemas(String)

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

傳回 XmlSchemaSet 中屬於指定命名空間之所有 XML 結構描述定義語言 (XSD) 結構描述的集合。

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

參數

targetNamespace
String

結構描述 targetNamespace 屬性。

傳回

ICollection 物件,包含已加入至 XmlSchemaSet 之屬於指定命名空間的所有結構描述。 如果結構描述尚未加入至 XmlSchemaSet,則會傳回空的 ICollection 物件。

範例

下列範例說明如何逐一查看 命名空間中的所有 http://www.contoso.com/booksXmlSchemaSet 架構。

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);
}

備註

targetNamespace如果 參數為 nullEmpty ,則會傳回不含命名空間的所有架構。

這個方法會傳回間接新增至 的 XmlSchemaSet 架構,因為它們已匯入。

注意

方法 Schemas 相當於 Item[] 過時 XmlSchemaCollection 的 方法。

適用於