SecurityElement.SearchForTextOfTag(String) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
タグ名を指定して子要素を検索し、格納されているテキストを返します。
public:
System::String ^ SearchForTextOfTag(System::String ^ tag);
public string? SearchForTextOfTag (string tag);
public string SearchForTextOfTag (string tag);
member this.SearchForTextOfTag : string -> string
Public Function SearchForTextOfTag (tag As String) As String
パラメーター
- tag
- String
子要素で検索するタグ。
戻り値
指定したタグ値を持つ最初の子要素のテキストの内容。
例外
tag
が null
です。
例
次のコードは、メソッドを使用し SearchForTextOfTag て、タグ名によって子を検索し、含まれているテキストを返す方法を示しています。 このコード例は、SecurityElement クラスのために提供されている大規模な例の一部です。
String^ storedDestroyTime = localXmlElement->SearchForTextOfTag( L"destroytime" );
string storedDestroyTime =
localXmlElement.SearchForTextOfTag("destroytime");
Dim storedDestroyTime As String = localXmlElement.SearchForTextOfTag("destroytime")
注釈
このメソッドは、次の場合と同じです。
String^ SearchForTextOfTag(String^ tag)
{
SecurityElement^ element = this->SearchForChildByTag(tag);
return element->Text;
}
string SearchForTextOfTag(string tag)
{
SecurityElement element = this.SearchForChildByTag(tag);
return element.Text;
}
Public Function SearchForTextOfTag(ByVal tag As String) As String
Dim element As SecurityElement = MyClass.SearchForChildByTag(tag)
Return element.Text
End Function
次の XML で SearchForTextOfTag("second")
は、は "text2" を返します。
<thetag A="123" B="456" C="789"> <first>text1</first>
<second>text2</second></thetag>