Share via


_XDocument3.GetNamedNodeProperty Method

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
'Usage

Parameters

  • varMainDOMNode
    An XML node corresponding to a nonattribute node in the main data source, for which a named property is to be returned.
  • bstrPropertyName
    Specifies the name of the property whose value is to be returned.
  • bstrDefaultValue
    Specifies the default value to be returned if the property has not been set.

Return Value

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

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.

Example

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
Microsoft.Office.Interop.InfoPath Namespace