Share via


_XDocument4.GetNamedNodeProperty method (Object, String, String)

Gets the value of a named property for the specified XML node, which must be a nonattribute node in the main data source.

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)

Syntax

'Declaration
Function GetNamedNodeProperty ( _
    varMainDOMNode As Object, _
    bstrPropertyName As String, _
    bstrDefaultValue As String _
) As String
'Usage
Dim instance As _XDocument4
Dim varMainDOMNode As Object
Dim bstrPropertyName As String
Dim bstrDefaultValue As String
Dim returnValue As String

returnValue = instance.GetNamedNodeProperty(varMainDOMNode, _
    bstrPropertyName, bstrDefaultValue)
string GetNamedNodeProperty(
    Object varMainDOMNode,
    string bstrPropertyName,
    string bstrDefaultValue
)

Parameters

  • varMainDOMNode
    Type: System.Object

    An XML node corresponding to a nonattribute node in the main data source, for which a named property is to be returned.

  • bstrPropertyName
    Type: System.String

    Specifies the name of the property whose value is to be returned.

  • bstrDefaultValue
    Type: System.String

    Specifies the default value to be returned if the property has not been set.

Return value

Type: System.String
The named property for the specified XML node, which must be a nonattribute node in the main data source.

Implements

_XDocument3.GetNamedNodeProperty(Object, String, String)

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 SetNamedNodeProperty(IXMLDOMNode, String, String) method. Use the GetNamedNodeProperty method to read the value of a named property.

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.GetNamedNodeProperty(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:GetNamedNodeProperty(item, 'cost', 'empty')"/>

See also

Reference

_XDocument4 interface

_XDocument4 members

GetNamedNodeProperty overload

Microsoft.Office.Interop.InfoPath namespace