XmlSchemaSet.Schemas 方法

定義

傳回 XmlSchemaSet 中 XML 結構描述定義語言 (XSD) 結構描述的集合。Returns a collection of XML Schema definition language (XSD) schemas in the XmlSchemaSet.

多載

Schemas()

傳回 XmlSchemaSet 中所有 XML 結構描述定義語言 (XSD) 結構描述的集合。Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet.

Schemas(String)

傳回 XmlSchemaSet 中屬於指定命名空間之所有 XML 結構描述定義語言 (XSD) 結構描述的集合。Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet that belong to the given namespace.

Schemas()

傳回 XmlSchemaSet 中所有 XML 結構描述定義語言 (XSD) 結構描述的集合。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

傳回

ICollection 物件,包含已加入至 XmlSchemaSet 的所有結構描述。An ICollection object containing all the schemas that have been added to the XmlSchemaSet. 如果結構描述尚未加入至 XmlSchemaSet,則會傳回空的 ICollection 物件。If no schemas have been added to the XmlSchemaSet, an empty ICollection object is returned.

範例

下列範例說明如何反復查看 XmlSchemaSet中的所有架構。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);  
}  

備註

這個方法會傳回間接新增至 XmlSchemaSet 的架構,因為它們已匯入。This method returns schemas that were added indirectly to the XmlSchemaSet because they were imported.

注意

Schemas 方法相當於過時 XmlSchemaCollectionGetEnumerator 方法。The Schemas method is the equivalent of the GetEnumerator method of the obsolete XmlSchemaCollection.

Schemas(String)

傳回 XmlSchemaSet 中屬於指定命名空間之所有 XML 結構描述定義語言 (XSD) 結構描述的集合。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);
member this.Schemas : string -> System.Collections.ICollection
Public Function Schemas (targetNamespace As String) As ICollection

參數

targetNamespace
String

結構描述 targetNamespace 屬性。The schema targetNamespace property.

傳回

ICollection 物件,包含已加入至 XmlSchemaSet 之屬於指定命名空間的所有結構描述。An ICollection object containing all the schemas that have been added to the XmlSchemaSet that belong to the given namespace. 如果結構描述尚未加入至 XmlSchemaSet,則會傳回空的 ICollection 物件。If no schemas have been added to the XmlSchemaSet, an empty ICollection object is returned.

範例

下列範例說明如何反復查看 XmlSchemaSethttp://www.contoso.com/books 命名空間內的所有架構。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);  
}  

備註

如果 targetNamespace 參數是 nullEmpty,則會傳回不含命名空間的所有架構。If the targetNamespace parameter is null or Empty, then all schemas without a namespace are returned.

這個方法會傳回間接新增至 XmlSchemaSet 的架構,因為它們已匯入。This method returns schemas that were added indirectly to the XmlSchemaSet because they were imported.

注意

Schemas 方法相當於過時 XmlSchemaCollectionItem[String] 方法。The Schemas method is the equivalent of the Item[String] method of the obsolete XmlSchemaCollection.

適用於