XmlSchemaSet.Schemas 方法

定义

返回 XML 架构定义语言 (XSD) 架构的 XmlSchemaSet集合。

重载

名称 说明
Schemas()

返回所有 XML 架构定义语言 (XSD) 架构的 XmlSchemaSet集合。

Schemas(String)

返回属于给定命名空间的所有 XML 架构定义语言 (XSD) 架构 XmlSchemaSet 的集合。

Schemas()

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

返回所有 XML 架构定义语言 (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 对象,其中包含已添加到该 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
Source:
XmlSchemaSet.cs
Source:
XmlSchemaSet.cs

返回属于给定命名空间的所有 XML 架构定义语言 (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/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);
}

注解

如果参数 targetNamespacenullEmpty,则返回不带命名空间的所有架构。

此方法返回间接添加到架构的架构, XmlSchemaSet 因为它们已导入。

注释

该方法 Schemas 等效于 Item[] 过时 XmlSchemaCollection的方法。

适用于