XmlSchemaCollection.Item[String] Propiedad
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene el XmlSchema asociado al URI del espacio de nombres especificado.
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
- ns
- String
URI del espacio de nombres asociado al esquema que desea que se devuelva. Normalmente será el targetNamespace
del esquema.
XmlSchema
asociado al URI del espacio de nombres; null
si no se ha cargado ningún esquema asociado al espacio de nombres especificado o si el espacio de nombres está asociado a un esquema XDR.
En el ejemplo siguiente se comprueba si un esquema está en la colección. Si es así, muestra el esquema.
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
Importante
La XmlSchemaCollection clase está obsoleta en .NET Framework versión 2.0 y se ha reemplazado por la XmlSchemaSet clase .
Producto | Versiones |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Comentarios de .NET
.NET es un proyecto de código abierto. Seleccione un vínculo para proporcionar comentarios: