Share via


XDocument.SetNamedNodeProperty Method

InfoPath Developer Reference

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

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.SetNamedNodeProperty(pxmlMainDOMNode, bstrPropertyName, bstrValue)

expression   An expression that returns a XDocument object.

Parameters

Name Required/Optional Data Type Description
pxmlMainDOMNode Required [IXMLDOMNODE] An XML node corresponding to a nonattribute node in the main data source, for which a named property is to be set.
bstrPropertyName Required String Specifies the name of the property being set.
bstrValue Required String Specifies the value to which the property will be set.

Return Value
Nothing

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.

Security Level 2: 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.

Example

In the following example, the value of a named property (with the name "cost") of an XML node (called "item") is set by using the SetNamedNodeProperty method:

JScript
  var objXMLNode = XDocument.DOM.selectSingleNode("/items/item");
XDocument.SetNamedNodeProperty(objXMLNode, 'cost', '100');
var strTest = XDocument.GetNamedNodeProperty(myNode, 'cost', 'empty');

See Also