_XDocument4.GetNamedNodeProperty(Object, String, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the value of a named property for the specified XML node, which must be a nonattribute node in the main data source.
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
Parameters
- varMainDOMNode
- Object
An XML node corresponding to a nonattribute node in the main data source, for which a named property is to be returned.
- bstrPropertyName
- String
Specifies the name of the property whose value is to be returned.
- bstrDefaultValue
- String
Specifies the default value to be returned if the property has not been set.
Returns
The named property for the specified XML node, which must be a nonattribute node in the main data source.
Implements
Examples
The following example demonstrates setting and getting the value of a named property (with the name "cost") of an XML node (called "item"):
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");
In the following XSL example, the "cost" named property of the item node is displayed:
<xsl:value-of select="xdXDocument:<span class="label">GetNamedNodeProperty</span>(item, 'cost', 'empty')"/>
The following example demonstrates setting and getting the value of a named property (with the name "cost") of an XML node (called "item"):
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");
In the following XSL example, the "cost" named property of the item node is displayed:
<xsl:value-of select="xdXDocument:<span class="label">GetNamedNodeProperty</span>(item, 'cost', 'empty')"/>
Remarks
Named properties allow users to associate strings with user-defined properties of XML element nodes in the main data source. The value of a named property can be set by using the Microsoft.Office.Interop.InfoPath._XDocument4.SetNamedNodeProperty(Microsoft.Office.Interop.InfoPath.IXMLDOMNode,System.String,System.String) method. Use the GetNamedNodeProperty method to read the value of a named property.
Applies to
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기