Use the XML command to process XML information that is generated from web services and cloud computing applications.
The XML command supports sessions, node editing, and Xpath expression execution, based on a tree structure of an XML document. The command enables the automated Task Bot / MetaBot Logic to navigate the tree and make selections based on various criteria.
The XML command enables users to capture data that has XML formatting and save it to a specified location.
To learn more, search for the Automating Structured Data: How to Work with XML Streams and Automating Tasks Using the XML Command courses in Automation Anywhere University: RPA Training and Certification (A-People login required).
- Start XML Session
- Specifies the session name and data source (a file or text).
- End XML Session
- Complements the Start XML Session operation by closing an open XML session.
- Insert Node
- Specifies node name and value. The location of the node is based on the position of the XPath Expression.
- Specifies action if node name is present (Insert It Anyways, Skip It, or Overwrite It) and where to insert node location (Beginning, End, Before Specific child node, or After Specific child node.
Note: If Before Specific child node or After Specific child node is selected, specify child node name.
- In the XML command, when
you insert a node into the XML file,
DefaultNSPrefixis no longer added. In the Advanced view tab of the Insert Node command, xmlns (default XML namespace) is not allowed either as a prefix or as an attribute. You can enable the
DefaultNSPrefixmanually by setting the value of
truein the AA.settings file in .Note: If
DefaultNSPrefixis enabled and the value of
allowaddingdefaultnamespaceis set as
true, you might encounter an issue. When you insert or update a new node as an empty node, a newline character will be added, and indentation will not be maintained.
- Delete Node/Attribute
- Deletes a node or attribute from the XML file by specifying the XPath Expression.
- Update Nodes
- Updates nodes in a session at the position that is specified for the XPath Expression.
- Update Attributes: Mark the check box to add, update, or delete attributes.
- Validate XML Document
Validates session data using XML schema files (.xsd), internal Document Type Definitions (DTDs), or if the session data is Well Formed.
Validation output (VALID or INVALID) can be assigned to a variable. If an error occurs during validation, it is stored in the system variables named: $Error Line Number$ and $Error Description$.
- Get Node(s)
- Retrieves the value(s) of a single or multiple node(s) in the session data by
specifying the XPath Expression.
- Get Single Node: Retrieves the value of a single node or attribute from the session data, at the position specified in the XPath expression. The value is assigned to a variable.
- Get Multiple Nodes: Retrieves values from multiple nodes in the session data, using Text value/XPath expression/Specified attribute name, based on the specified XPath expression.
- The value is assigned to a system variable named $XML Data Node (Node name)$, which can be used in conjunction with a LOOP command. For example, a Loop command can be used to search each node in an XML data set.
- Save Session Data
- Session data is an entity used to save session context information. You can save the session to assign the current state of the XML data to a file or a variable.
Write XML Data: Mark the check box to save the data to a
The data is saved in an XML file encoded in UTF-8 format.
- Execute XPath Function
- Executes an XPath function and stores the results in a variable.