XmlSchemaCollection.Item Property
Gets the XmlSchema associated with the given namespace URI.
Assembly: System.Xml (in System.Xml.dll)
Parameters
- ns
- Type: System.String
The namespace URI associated with the schema you want to return. This will typically be the targetNamespace of the schema.
Property Value
Type: System.Xml.Schema.XmlSchemaThe XmlSchema associated with the namespace URI; null if there is no loaded schema associated with the given namespace or if the namespace is associated with an XDR schema.
Important Note: |
|---|
The XmlSchemaCollection class is obsolete in the .NET Framework version 2.0 and has been replaced by the XmlSchemaSet class. |
The following example checks to see if a schema is in the collection. If it is, it displays the schema.
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(S"urn:bookstore-schema"))
{
XmlSchema* schema = xsc->Item[S"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);
}
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Important Note: