XML - Import

Declaration

<AMXML ACTIVITY="import" XPATH="text" XPATHFILE="text" FILE="text" SESSION="text" />

Related Topics  

Description

Merges two XML files together into a single file. XPaths can be provided to customize both insertion points into the host XML file as well as node offsets in the file being merged from. If the user provides the Xpath expression for File 2 then that XML fragment from File 2 is appended to File 1.

IMPORTANT: The use of Automate's XML activities requires a fundamental understanding of XML schema and general knowledge of XML-related terms, such as Nodes, XPath, DTD and XSLT.  

Practical Usage

Used for importing or inserting nodes in a specific location of an existing node.

Parameters

Session

Property Type Required Default Markup Description
Session Text Yes XMLSession1 SESSIONNAME="myXMLSession" The name of an existing XML 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 instead of the original. 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

Property Type Required Default Markup Description
XPath expression (optional) Text No (Empty) XPATH="/Root1" The file in which you want to store the fragment as a first child of root node.
File Text Yes (Empty) FILE="C:\Automate\Append.XML" The file in which to merge into the current XML document.
XPath expression for file (optional) Text Yes (Empty) XPATHFILE="/Root2" The XPath expression identifying the offset node for second file.
Namespace Prefix Text No (Empty) PREFIX="PrefixName" The prefix associated to the added namespace. Use this parameter to insert namespace prefix and URI values into the new node. To enter a new row of values select Click here to add new row. To delete an existing row, click the red "X." This parameter supports insertion of multiple namespace prefixes and URIs.
Namespace URI Text No (Empty) URI="URIName" The URI associated to the added namespace. Use this parameter to insert namespace prefix and URI values into the new node. To enter a new row of values select Click here to add new row. To delete an existing row, click the red "X." This parameter supports insertion of multiple namespace prefixes and URIs

Description

Error Causes

On Error

Example

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

Description

This sample task imports nodes from file C:\Automate\Append.xml.

Copy
<AMXML ACTIVITY="import" FILE="C:\Automate\Append.xml" SESSION="XmlSession1" />