XML - Save

Declaration

<AMXML ACTIVITY="save" XMLDESTINATION="text" SESSION="text" />

Related Topics  

Description

Saves the in-memory representation of the XML session, for example, to a file or variable before ending the XML session. Using this action does not end the session, thus allowing subsequent XML steps to continue using the session.

IMPORTANT: The use of Automate Desktop'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

Outputs XML data currently saved onto a document or variable.

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. 

Save

Property Type Required Default Markup Description
Save to Text (options) Yes New
  • SAVEMODE="new_file"
  • SAVEMODE="original_file"
  • SAVEMODE="variable"
Specifies where the XML file/data should be saved to. The available options are:
  • New (default) - Save XML to a new file.
  • Original - Save XML to original file. During Create session step, if new file is created or existing file is used, then this option will use that file to store the modified XML document.
  • Variable - Save XML to variable.
File Text Yes, if Save to parameter set to New (Empty) XMLDESTINATION="c:\temp\file.xml" The path and file name to save the XML data. This parameter is available only if the Save to parameter is set to New.
Overwrite if file exists Yes/No Yes, if Save to parameter set to New No OVERWRITEFILE="YES" If selected, if an XML file with the same name exists in the destination, it will be overwritten. If disabled, an error will occur as a result of matching XML files. This parameter is disabled by default and is active only if the Save to parameter is set to New.
Decode XML value Yes/No Yes, if Save to parameter set to Variable No DECODEXML="YES" If selected, reverses the transformation for all the encoding methods. If disabled (default) no decoding will take place. Encoding XML allows colons in any position, which means that the name may still be invalid according to the W3C Namespaces in XML Recommendation. This parameter is available only if the Save to parameter is set to Variable.
Populate variable with value Text Yes, if Save to parameter set to Variable (Empty) RESULTVARIABLE="XMLdata" The name of an existing variable in which to output the XML data. This parameter is available only if the Save to parameter is set to Variable.

Description

Error Causes

On Error

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task outputs XML to a variable.

Copy
<AMXML ACTIVITY="save" SAVEMODE="original_file" SESSION="XmlSession1" />
Note : Changes to be saved into the same file.
<AMXML ACTIVITY="save" SAVEMODE="variable" RESULTVARIABLE="Output_XML" SESSION="XmlSession1" />
Note: XML document data to be put into a Automate variable.