指定した名前空間を持つスキーマがコレクション内に存在するかどうかを示す値を取得します。
オーバーロードの一覧
指定した名前空間を持つスキーマがコレクション内に存在するかどうかを示す値を取得します。
[Visual Basic] Overloads Public Function Contains(String) As Boolean
指定した XmlSchema の targetNamespace がコレクション内に存在するかどうかを示す値を取得します。
[Visual Basic] Overloads Public Function Contains(XmlSchema) As Boolean
使用例
[Visual Basic, C#, C++] スキーマがコレクション内に存在するかどうかを確認する例を次に示します。コレクション内に存在する場合は、そのスキーマを表示します。
[Visual Basic, C#, C++] メモ ここでは、Contains のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
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
[C#]
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());
}
[C++]
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);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
参照
XmlSchemaCollection クラス | XmlSchemaCollection メンバ | System.Xml.Schema 名前空間