XML - Export

Declaration

<AMXMLEXTRACTFRAGMENT XPATH="text" XMLDESTINATION="text" ROOTNODENAME="text" OVERWRITEFILE="text [options]" />

See Also

XML - Create Node | XML - Create Session | XML - Dataset to XML | XML - Delete Node | XML - Edit Node | XML - End Session | XML - Evaluate Xpath | XML - Import | XML - Node to Dataset | XML - Read Node | XML - Save | XML - Sign | XML - Transform | XML - Validate | XML - Verify

Extract XML Fragment

Declaration

<AMXMLEXTRACTFRAGMENT XPATH="text" XMLDESTINATION="text" ROOTNODENAME="text" OVERWRITEFILE="text [options]" />

See Also

Create XML Node | Dataset to XML | Delete XML Node | Edit XML Node | End XML Session | Evaluate Xpath Expression | Extract XML Fragment | Merge XML Files | Output XML | Read XML Node | Sign XML Document | Start XML Session | Transform XML | Validate XML File | Verify XML Document | XML Node to Dataset

Description

Extracts an XML fragment (i.e. a collection of nodes) located at the specified XPath and saves it to a new file.

IMPORTANT: AutoMate's XML actions require a basic understanding of XML and related terms, such as XPath, DTD and XSLT.

Practical Usage

Useful for parsing an XML file.

Parameters

General Properties

Property

Type

Req'd

Default

Markup

Description

XPath Expression

Text

Yes

(Empty)

XPATH="/BookStore/Books/Price"

The Xpath expression to the node which you want to fragment from the current XML document.

Output File

Text

Yes

(Empty)

XMLDESTINATION="C:\ExtractedXML.xml"

The file in which you want to store the fragment as a first child of root node.

Root node name of output

Text

Yes

(Empty)

ROOTNODENAME="RootNodeName"

The name of the root node for the new XML file.

Overwrite if File Exists

Yes/No

No

No

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 (default), the step fails if the file already exists.

Session Name

Text

No

(Empty)

SESSIONNAME="FirstXMLSession"

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.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

 

<AMXMLEXTRACTFRAGMENT XPATH="/BookMarks/Money" XMLDESTINATION="C:\Output.xml" OVERWRITEFILE="YES" ROOTNODENAME="Automate" SESSIONNAME="XML1" />

 

↑ Top of Page