XmlSchemaCollection.Item[String] Vlastnost

Definice

XmlSchema Získá přidružené k danému identifikátoru URI oboru názvů.

public:
 property System::Xml::Schema::XmlSchema ^ default[System::String ^] { System::Xml::Schema::XmlSchema ^ get(System::String ^ ns); };
public System.Xml.Schema.XmlSchema? this[string? ns] { get; }
public System.Xml.Schema.XmlSchema this[string ns] { get; }
member this.Item(string) : System.Xml.Schema.XmlSchema
Default Public ReadOnly Property Item(ns As String) As XmlSchema

Parametry

ns
String

Identifikátor URI oboru názvů přidružený ke schématu, které chcete vrátit. Obvykle se jedná o targetNamespace schéma.

Hodnota vlastnosti

XmlSchema

Přidruženo XmlSchema k identifikátoru URI oboru názvů; null pokud neexistuje žádné načtené schéma přidružené k danému oboru názvů nebo pokud je obor názvů přidružený ke schématu XDR.

Příklady

Následující příklad zkontroluje, jestli je schéma v kolekci. Pokud ano, zobrazí schéma.

if ( xsc->Contains( "urn:bookstore-schema" ) )
{
   XmlSchema^ schema = xsc[ "urn:bookstore-schema" ];
   StringWriter^ sw = gcnew StringWriter;
   XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( sw );
   xmlWriter->Formatting = Formatting::Indented;
   xmlWriter->Indentation = 2;
   schema->Write( xmlWriter );
   Console::WriteLine( sw );
}
if (xsc.Contains("urn:bookstore-schema"))
{
  XmlSchema schema = xsc["urn:bookstore-schema"];
  StringWriter sw = new StringWriter();
  XmlTextWriter xmlWriter = new XmlTextWriter(sw);
  xmlWriter.Formatting = Formatting.Indented;
  xmlWriter.Indentation = 2;
  schema.Write(xmlWriter);
  Console.WriteLine(sw.ToString());
}
If xsc.Contains("urn:bookstore-schema") Then
    Dim schema As XmlSchema = xsc("urn:bookstore-schema")
    Dim sw As New StringWriter()
    Dim xmlWriter As New XmlTextWriter(sw)
    xmlWriter.Formatting = Formatting.Indented
    xmlWriter.Indentation = 2
    schema.Write(xmlWriter)
    Console.WriteLine(sw.ToString())
End If

Poznámky

Důležité

Třída XmlSchemaCollection je zastaralá v rozhraní .NET Framework verze 2.0 a byla nahrazena XmlSchemaSet třídou.

Platí pro