Create XML Node Action

Declaration

<AMXMLCREATENODE XPATH="text" NEWNODE="text" NEWVALUE="text"><Attribute Name="text" Value="text" /></AMXMLCREATENODE>

See Also

Delete XML Node Action, Edit XML Node Action

Description

Creates a new node in an existing XML file. Optionally assigns a value and attributes to the node.

Practical Usage

See Description.

Parameters

General Tab

XPath expression

Text, Required
MARKUP: XPATH="/Marie"

Specifies the XPath expression to the XML node to create.

Name

Text, Required
MARKUP: NEWNODE="NODENAME"

Specifies the name of the new node to be created.

Value

Text, Optional
MARKUP: NEWVALUE="NODEVALUE"

Specifies the value of the new node to be created.

If node already exists

Text [Options], Optional Default "Ignore"
MARKUP:
NODEWITHSAMENAMEEXISTTHEN="Skip"
NODEWITHSAMENAMEEXISTTHEN="Overwrite"
NODEWITHSAMENAMEEXISTTHEN="Fail"

Specifies what to do if a node with same name as the one being inserted at the current location already exists.

The available options are:

Insert as First Child Node

Yes/No, Optional - Default "NO"
MARKUP: INSERTASFIRSTCHILD="YES"

If checked, allows you to insert the new node as a first child of the parent node found using Xpath Expression. Default is unchecked.

Sessionname

Text, Optional - Default "XMLSession1"
MARKUP: SESSIONNAME="FirstXMLSession"

Specifies the session name to identify the in-memory XML document to use in subsequent XML steps. This allows several in-memory XML documents to be active simultaneously.

Attributes Tab

Use this tab to insert attributes into new node.

Attribute Name

Text, Optional
MARKUP: Name="AttributeName"

Specifies the name of the attribute.

Attribute Value

Text, Optional
MARKUP: Value="Attribute Value"

Specifies the value of the attribute.

Move Up

Once you have specified an attribute, use this button to move it up on the list.

Move Down

Once you have specified an attribute, use this button to move it up on the list.

Add

Once you have given the Attribute Name and Value, click Add to add them to list.

Modify

Use this button to modify attribute names and values.

Remove

Use this button to remove attribute names and values.

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMXMLCREATENODE XPATH="/BookStore/Book" NEWNODE="Author" NEWVALUE="Albert" INSERTASFIRSTCHILD="YES" NODEWITHSAMENAMEEXISTTHEN="Skip"><Attribute Name="LastName" Value="BlackWell" /></AMXMLCREATENODE>