次の方法で共有


_XDocument2.GetNamedNodeProperty(Object, String, String) メソッド

定義

指定した XML ノードの名前付きプロパティの値を取得します。このノードは、メイン データ ソースの nonattribute ノードである必要があります。

public:
 System::String ^ GetNamedNodeProperty(System::Object ^ varMainDOMNode, System::String ^ bstrPropertyName, System::String ^ bstrDefaultValue);
public string GetNamedNodeProperty (object varMainDOMNode, string bstrPropertyName, string bstrDefaultValue);
abstract member GetNamedNodeProperty : obj * string * string -> string
Public Function GetNamedNodeProperty (varMainDOMNode As Object, bstrPropertyName As String, bstrDefaultValue As String) As String

パラメーター

varMainDOMNode
Object

メイン データ ソースの nonattribute ノードに対応する XML ノード。このノードの名前付きプロパティが返されることになります。

bstrPropertyName
String

値を返すプロパティの名前を指定します。

bstrDefaultValue
String

プロパティが設定されていない場合に返す既定値を指定します。

戻り値

指定の XML ノードの名前付きプロパティ。このノードは、メイン データ ソースの nonattribute ノードである必要があります。

次の例では、XML ノード (名前 "item") の名前付きプロパティ (名前 "cost") の値を取得および設定しています。

IXMLDOMNode item = thisXDocument.DOM.selectSingleNode(@"/items/item");
string test = thisXDocument.<span class="label">GetNamedNodeProperty</span>(item, 'cost', 'Value not set');
// The value of the "cost" named property is set to 100.
thisXDocument.SetNamedNodeProperty(item, "cost", "100");
test = thisXDocument.GetNamedNodeProperty(item, "cost", "Value not set");

以下の XSL の例では、item ノードの "cost" 名前付きプロパティを表示しています。

&lt;xsl:value-of select="xdXDocument:<span class="label">GetNamedNodeProperty</span>(item, 'cost', 'empty')"/&gt;

次の例では、XML ノード (名前 "item") の名前付きプロパティ (名前 "cost") の値を取得および設定しています。

IXMLDOMNode item = thisXDocument.DOM.selectSingleNode(@"/items/item");
string test = thisXDocument.<span class="label">GetNamedNodeProperty</span>(item, 'cost', 'Value not set');
// The value of the "cost" named property is set to 100.
thisXDocument.SetNamedNodeProperty(item, "cost", "100");
test = thisXDocument.GetNamedNodeProperty(item, "cost", "Value not set");

以下の XSL の例では、item ノードの "cost" 名前付きプロパティを表示しています。

&lt;xsl:value-of select="xdXDocument:<span class="label">GetNamedNodeProperty</span>(item, 'cost', 'empty')"/&gt;

注釈

名前付きプロパティを使用すると、ユーザーがメイン データ ソースに含まれている XML 要素ノードのユーザー定義プロパティに文字列を関連付けることができるようになります。 名前付きプロパティの値は、GetNamedNodeProperty メソッドを使用してSetNamedNodeProperty(IXMLDOMNode, String, String)、名前付きプロパティの値を読み取ることによって設定できます。

重要: このメンバーにアクセスできるのは、現在開いているフォームと同じドメインで実行されているフォーム、またはクロスドメインアクセス許可が付与されているフォームのみです。

適用対象