Add Element Action

The Add Element action adds an Xml element to an existing xml document.  To use this action you provide a path to an existing Xml Document by selecting from a list of known folders on the client target and then providing a sub path and file name.

You then provide an XPath expression to identify the parent element that the new element will be added to.  If more than one element matches the Xpath expression, you can choose one of five actions:

 

Once the parent node is found, you can choose to add the new element at the beginning (before siblings) or at the end (after siblings) of the parent document element.

A new element is added at this location using the element name provided.  If a value is provided, the text will be placed inside opening and closing tags.

 

If an element already exists that matches the element being added, you can choose take one of four actions:

This action requires a full path to an xml file, defined by setting a target client folder, any appropriate sub path information and a file name.  In addition to the full file path, the element name must be provided.  The element value is optional.

A list of Attributes can be defined, which will be added to the newly created element.

 

Prepare Stage

Verifies permissions to modify the xml file.

Execute Stage

Backs up the xml file then inserts the new xml element, performing the operation as defined by the action properties.

Cleanup Stage

Removes the backup file created during the execute stage.

Rollback Stage

Restores the xml file with the file backed up in the execute stage.

 

Add Xml Element Action Editor

Action description – Descriptive text that can be used to identify this particular action in the Actions list.

 

Target client folder – The folder on the client where the xml file that is to be edited is located.

 

Subdirectories – The directory below the designated client root folder to find the xml file that is to be edited.

 

XML file to edit – The name of the xml file that is to be edited.

 

XPath query to select the element into which to add the attribute – Use an XPath expression to identify the node within the xml file that you want to add an element to.

 

New element  name and value – Type the name and value of the new Xml Element that you want to add.

 

If one or more matching elements is found – In the event that one or more elements are found that match the element that is being added, you can choose to:

 

If multiple parent elements are found – Identify the action that you want to occur in the event that multiple xml elements are returned by your XPath expression.  You can choose to:

 

Expansion variables can be used to set target client subdirectory, file name of the xml file to edit, Xpath query, new element name, and new element value.