Feedback

  • Contents
 

XML Set Node Value

This XML tool sets the value of a node. This operation is only allowed on Element, Attribute, Text, CDATA, Comment and Processing Instruction nodes. All other nodes cause an error.

If the node is an Attribute the value must be coercible into the data type defined for that node (either with ‘XML Create Node’ or in the Schema defining the attribute). If the type is not coercible, an error is issued.
If the node is an Element the value must be coercible into the data type set for that Element (‘Data Type’ in ‘XML Create Node’, dt:dt attribute of the element, or data type defined in the Schema definition). If the type is not coercible, an error is issued.

If the element has child elements, all child elements are replaced by one text node with the value.
If the Element is empty, a new text node with the value is added as the only child.

Example:

Given the following node (we assume here that dt is the prefix for "urn:schemas-microsoft-com:datatypes"):

<FOO dt:dt="int">-12345</FOO>

Passing the node and "abcd" as argument will cause an error because "abcd" cannot be parsed into a number. If no data type is defined for that node, the call succeeds, setting "abcd" as the new contents of the text child node.

NOTE: If the node is an empty element, a text node child is added.

Inputs

Node

The node with the value to be changed.

Node Value

The string to set as the node value.

New Data Type

This is the new data type to set before setting the value. See the XML Get Node Info tool for a list of valid data types. If the data type is not specified, the type will not be changed. If the string is left empty, the dt:dt attribute is removed.

Exit Paths

Success

This path is taken if the node value was successfully set.

Failure

This path is taken if the operation fails.