XML - Edit Node

Declaration

<AMXMLEDITNODE XPATH="text" XMLATTRIBUTE="text" NEWVALUE="text" />

See Also

XML - Create Node | XML - Create Session | XML - Dataset to XML | XML - Delete Node | XML - End Session | XML - Evaluate Xpath | XML - Export | XML - Import | XML - Node to Dataset | XML - Read Node | XML - Save | XML - Sign | XML - Transform | XML - Validate | XML - Verify

Edit XML Node

Declaration

<AMXMLEDITNODE XPATH="text" XMLATTRIBUTE="text" NEWVALUE="text" />

See Also

Create XML Node | Dataset to XML | Delete XML Node | Edit XML Node | End XML Session | Evaluate Xpath Expression | Extract XML Fragment | Merge XML Files | Output XML | Read XML Node | Sign XML Document | Start XML Session | Transform XML | Validate XML File | Verify XML Document | XML Node to Dataset

Description

Edits a node value or its attribute in a given file. Select the appropriate node using Xpath expression. Note that the action will edit the first node if Xpath evaluates to more than one node.

NOTE: When creating an XML task, it is required that an XML session name is initially generated using the Start XML Session action. XML - Create Session activity. This session can be identified by subsequent XML steps that include the same session name, allowing several XML documents to be active within the same task. When an XML session is created, the XML file bound by that session becomes locked. An End XML Session action XML - End Session activity can be used to end the current session and unlock the XML file bound to that session.

During an XML session, modifications are not performed on the original XML file bound by that session. Rather, as a safety measure, a copy of the file is saved to memory upon the creation of a session. Any modifications performed by subsequent XML steps are performed on the copy of the XML data saved to memory. Use the Output XML File action XML - Save activity to output the in-memory representation of the XML session to a file or variable. Using this step does not end the session, thus allowing subsequent XML steps to continue using the session. To end a session, use the  

 

IMPORTANT: AutoMate's XML actions require a basic understanding of XML and related terms, such as XPath, DTD and XSLT.

Practical Usage

See description.

Parameters

General Properties

Property

Type

Req'd

Default

Markup

Description

XPath Expression

Text

Yes

(Empty)

XPATH="/BookStore/Books/Price"

 The Xpath expression to the XML node in which to edit.

Attribute (optional)

Text

No

(Empty)

XMLATTRIBUTE="Price"

Tells the XML node the value of the attribute to edit.

Value

Text

No

(Empty)

NEWVALUE="NewValue"

The XML node's attribute to edit.

Edit Node

Text (options)

No

First

EDITNODE="All"

Specifies whether the first node or all nodes are to be edited. The available options are:

  • First (default) - The first node will be edited.

  • All - All nodes will be edited.

Session Name

Text

No

(Empty)

SESSIONNAME="FirstXMLSession"

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.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

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

 

Description: Edit XML node at XPath location "/BookStore/Book". Session name is "XMLSession1". Edit first node(s).

 

<AMXMLEDITNODE XPATH="/BookStore/Book" NEWVALUE="Who moved my Cheese" />

 

↑ Top of Page