Start XML Session Action

Declaration

<AMXMLSTARTSESSION XMLDOCUMENTFROM="text [options]" FILE="text" OVERWRITEFILE= "text [options]" XMLTEXT="text" ROOTNODENAME="text" NEWVALUE="text"><Attribute Name="text" Value="text" /></AMXMLSTARTSESSION>/>

See Also

End XML Session Action

Description

Create a new XML session based on an XML file or specified text.  This session can be used in subsequent XML steps to modify an in-memory copy of the XML data.  Use Output XML or End XML Session to output the final XML.

Practical Usage

To create an in-memory XML document.

Parameters

General Tab

Start XML Session From

Text [options], Optional - Default "ExistingFile"
MARKUP: XMLDOCUMENTFROM="NewFile"

Provides different options from which new in memory XML file can be created.

The available options are:

Existing File--allows you to browse for an existing XML file to use.

New File--allows you to create a new XML file to use.

Text--allows you to use specified XML text.

File

Text, Required
MARKUP: FILE="c:\foldername\file.XML"

Specifies the path of the new or existing XML file.

Note: Only available if you select existing file or new file option from Start XML Session From dropdown.

Overwrite if File Exists

Yes/No, Optional - Default "NO"
MARKUP: OVERWRITEFILE="YES"

If set to Yes, specifies that if the file already exists, it will be overwritten with the new document. If set to No, the step fails if the file already exists.

Note: Only available if you select the Existing File option from the Start XML Session From dropdown.

Text

Text, Required
MARKUP: XMLTEXT="aaa"

Allows you to paste XML text directly into the text field.

Note: Only available if you select the Text option from the Start XML Session From dropdown.

Root node name

Text, Required
MARKUP: ROOTNODENAME="Name"

Provides the root node name for new XML file.

Note: Only available if you select the New File option from the Start XML Session From dropdown.

Root node value (optional)

Text, Optional
MARKUP: NEWVALUE="Value"

Provides the root node value for new XML file.

Note: Only available if you select the New File option from the Start XML Session From dropdown.

Session Name

Text, Optional - Default "XMLSession1"
MARKUP: SESSIONNAME="FirstXMLSession"

Specifies 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.

Attributes Tab

Note: The tab remains greyed out unless you select the New File from the Start XML Session From dropdown.

Attribute Name

Text, Optional
MARKUP: Name="AttributeName"

Specifies the name of the attribute.

Attribute Value

Text, Optional
MARKUP: Value="Attribute Value"

Specifies the value of the attribute.

Move Up

Once you have specified an attribute, use this button to move it up on the list.

Move Down

Once you have specified an attribute, use this button to move it up on the list.

Add

Once you have given the Attribute Name and Value, click Add to add them to list.

Modify

Use this button to modify attribute names and values.

Remove

Use this button to remove attribute names and values.

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

<AMXMLSTARTSESSION XMLDOCUMENTFROM="ExistingFile" FILE="c:\automate.XML" />

<AMXMLSTARTSESSION XMLDOCUMENTFROM="NewFile" FILE="c:\log\logging.XML" ROOTNODENAME="Error" NEWVALUE="Automate Errors" OVERWRITEFILE="YES"> <Attribute Name="Version" Value="2.0" /></AMXMLSTARTSESSION>

<AMXMLSTARTSESSION XMLDOCUMENTFROM="Text" XMLTEXT="&lt;?XML version='1.0' encoding='UTF-8'?&gt;&#xD;&#xA;&lt;Marie /&gt;" />