_XDocument3.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.SemiTrust
Assembly:  Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)

Syntax

'Declaration
Function GetNamedNodeProperty ( _
    varMainDOMNode As Object, _
    bstrPropertyName As String, _
    bstrDefaultValue As String _
) As String
'Usage
Dim instance As _XDocument3
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

_XDocument2.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 method. Use the GetNamedNodeProperty method to read the value of a named property.

Important

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

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

_XDocument3 Interface

_XDocument3 Members

GetNamedNodeProperty Overload

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace