Feedback

  • Contents
 

XML Create Node

This XML tool creates a new node and optionally appends it as child of the Parent Node. The node is appended to the parent as described below:

Element

Parent node must be an Element or Document node. If it is an Element node, the new node is appended to the child list of the element. If it is a Document, the new node replaces the document element (root element).

Attribute

Parent node must be an Element. Node is added to the attributes of the element. If an attribute of the same name already exists, it is replaced.

Text, CDATA

Parent node must be an Element. Node is appended to the child list of the element.

Comment, Processing Instruction

Parent node must be an Element or Document. Node is added to the child list of the parent.

If a new node is created without a parent, the node will be a member of an empty dummy document just created for the node. Thus, the ‘Owner Document’ output of the XML Get Node Info tool always returns a document. Once the node is inserted into the document tree of a different document, the dummy document is destroyed.

Note: If creating the node fails, the output node is a document node (irrespective of the ‘Node Type’) that can be queried with XML Get Error Info for detailed error information. This document node is either the owner document of ‘Parent Node’, or, if no parent node is given, an empty dummy document. If something is seriously wrong and creating the document node failed, ‘Node’ will be NULL.

Inputs

Parent Node

Optional. Node to which to add this node as child. Semantics depend on the node type. If no parent node is given, the node may be added using the XML Insert Node tool. See description above.

Node Type

Integer value corresponding to the type of node to create. For list of values see XML Get Node Info tool. Nodes of type Document, Document Type, Entity, or Notation cannot be created.

Name

Fully qualified name of the node. Should be empty for nodes that have no name (CDATA, Comment, Text, Document, Document, Document Fragment).

Namespace URI

Namespace unique resource indicator (URI). If specified, the node is created in the context of this namespace with the prefix specified on the node name. If the Name parameter does not have a prefix, a default namespace declaration will be inserted as appropriate. This applies only to Element and Attribute nodes.

Node Value

Value of Attribute, Text, CDATA, Comment, and Processing Instruction (PI) nodes. If this argument is non-empty and the node is an Element, a text node is added as child of the Element containing that text. If a data type is defined, the node value must be parseable as that value.

May be left empty and then populated with the XML Set Node Value tool.

Data Type

String representation of the data type specifier included in the schema. Empty string: type undefined.

Ignored for node types that don’t support it.

This is the type defined as the nodes dt:dt attribute (dt is "urn:schemas-microsoft-com:datatypes" namespace)

Outputs

Node

Newly created node

Exit Paths

Success

This path is taken if the node was successfully created.

Failure

This path is taken if the operation fails.