XML - Delete Node

Declaration

<AMXMLDELETENODE XPATH="text" />

Description: Deletes all the nodes/attributes that match the Xpath expression in a given XML file.

IMPORTANT: Use of XML activities require a basic interpretation of XML schema and general knowledge of XML related terms, such as Nodes, XPath, DTD and XSLT.

Practical Usage

Used to remove a specified node. When a node is removed, all its child nodes are also removed.

Session Parameters

Property

Type

Required

Default

Markup

Description

Session

Text

Yes

XMLSession1

SESSIONNAME="myXMLSession"

The name of an existing session in which to associate this activity with. As a safety measure, when a session is created, the XML file bound by that session is saved in memory and the original file is locked. Any modifications by subsequent XML steps are performed on a copy of the XML data saved to memory. Linking several activities to a single session eliminates redundancy. Additionally, a single task supports simultaneous execution of multiple sessions, improving overall efficiency. Use the XML - Output file or XML - Save activity to output the in-memory representation of the XML session to a file or variable. To end the session, use the XML - End session activity. 

Node Parameters

Property

Type

Required

Default

Markup

Description

XPath Expression

Text

Yes

(Empty)

XPATH="/BookStore/Books/Price"

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

Attribute (optional)

Text

No

(Empty)

ATTRNAME="attributeName"

The attribute in which to delete.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: Delete nodes at XPath "/bookstore/book/price/Euro". Session name is "XMLSession1".

<AMXMLDELETENODE XPATH="/bookstore/book/price/Euro" />