指定した名前空間を持つスキーマがコレクション内に存在するかどうかを示す値を取得します。
Overloads Public Function Contains( _
ByVal ns As String _) As Boolean
[C#]
public bool Contains(stringns);
[C++]
public: bool Contains(String* ns);
[JScript]
public function Contains(
ns : String) : Boolean;
パラメータ
- ns
スキーマに関連付けられた名前空間 URI。XSD スキーマの場合、通常、これは対象となる名前空間です。
戻り値
指定した名前空間を持つスキーマがコレクション内に存在する場合は true 。それ以外の場合は false 。
使用例
[Visual Basic, C#, C++] スキーマがコレクション内に存在するかどうかを確認する例を次に示します。コレクション内に存在する場合は、そのスキーマを表示します。
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++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
XmlSchemaCollection クラス | XmlSchemaCollection メンバ | System.Xml.Schema 名前空間 | XmlSchemaCollection.Contains オーバーロードの一覧