語言

XmlSchemaSet.Schemas 方法

定義

回傳一組 XML Schema 定義語言(XSD)架構,格式為 XmlSchemaSet.

多載

名稱 Description
Schemas()

回傳所有 XML Schema 定義語言(XSD)架構的集合。XmlSchemaSet

Schemas(String)

回傳屬於指定命名空間的所有 XML Schema 定義語言(XSD)架構 XmlSchemaSet 集合。

Schemas()

來源:
XmlSchemaSet.cs
來源:
XmlSchemaSet.cs
來源:
XmlSchemaSet.cs
來源:
XmlSchemaSet.cs
來源:
XmlSchemaSet.cs

回傳所有 XML Schema 定義語言(XSD)架構的集合。XmlSchemaSet

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

傳回

一個 ICollection 包含所有已加入 的 XmlSchemaSetschema 的物件。 若未向 加入任何結構, 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 結構結構。

Note

該 Schemas 方法等價 GetEnumerator 於過時 XmlSchemaCollection的 方法。

適用於

Schemas(String)

來源:
XmlSchemaSet.cs
來源:
XmlSchemaSet.cs
來源:
XmlSchemaSet.cs
來源:
XmlSchemaSet.cs
來源:
XmlSchemaSet.cs

回傳屬於指定命名空間的所有 XML Schema 定義語言(XSD)架構 XmlSchemaSet 集合。

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/books中遍歷所有結構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);
}

備註

若targetNamespace參數為nullEmpty或,則所有無命名空間的結構都會回傳。

此方法回傳因匯入而間接加入的 XmlSchemaSet 結構結構。

Note

該 Schemas 方法等價 Item[] 於過時 XmlSchemaCollection的 方法。

適用於