Search

GlobalSCAPE Knowledge Base

How do I read an XML file in AWE?

EFT

THE INFORMATION IN THIS ARTICLE APPLIES TO:

  • EFT version 6.5 -8.1.x

DISCUSSION

You can use Advanced Workflow Engine (AWE) workflows to design scripts, batch files, macros, or any other code-intensive process using an easy drag-and-drop interface. AWE actions allow you to create custom, complex interactions within EFT. The XML class of actions can prove extremely helpful. There may be times that you want to create data driven processing in the form of configurations or even data elements. The simple case below describes an XML file with file information and associates attributes. The Advanced Workflow file provided will read the XML file and place each file element in an AML dataset object.

XML File

<?xml version="1.0" encoding="UTF-8"?>

<!--LRECL to File Name Mapping-->

<FileInfoMap>

<File>

<FileName>FILEone.txt</FileName>

<LRECL>80</LRECL>

<RECFM>FB</RECFM>

<BLKSIZE>8000</BLKSIZE>

</File>

<File>

<FileName>FILEtwo.txt</FileName>

<LRECL>80</LRECL>

<RECFM>VB</RECFM>

<BLKSIZE>8004</BLKSIZE>

</File>

<File>

<FileName>FILEthree.txt</FileName>

<LRECL>256</LRECL>

<RECFM>VB</RECFM>

<BLKSIZE>18000</BLKSIZE>

</File>

</FileInfoMap>

Advanced Workflow

<AMVARIABLE NAME="mapFile">G:\TEMP\LRECL XML Parsing AWE\lrecl_mapping.xml</AMVARIABLE>

<AMVARIABLE NAME="xmlMap"></AMVARIABLE>

<AMVARIABLE NAME="currentFileName"></AMVARIABLE>

<AMVARIABLE NAME="currentLRECL"></AMVARIABLE>

<AMVARIABLE NAME="currentRECFM"></AMVARIABLE>

<AMVARIABLE NAME="currentBLKSIZE"></AMVARIABLE>

<AMXMLSTARTSESSION XMLDOCUMENTFROM="ExistingFile" FILE="%mapFile%" />

<AMXMLNODEITERATOR XPATH="//FileInfoMap[1]/File" RESULTDATASET="fileInfoDS" VARVALUETYPE="XpathValue" />

<AMLOOP TYPE="DATASET" DATASET="fileInfoDS">

<AMXMLREADNODE XPATH="%fileInfoDS.Value%/FileName" RESULTVARIABLE="currentFileName" />

<AMXMLREADNODE XPATH="%fileInfoDS.Value%/LRECL" RESULTVARIABLE="currentLRECL" />

<AMXMLREADNODE XPATH="%fileInfoDS.Value%/RECFM" RESULTVARIABLE="currentRECFM" />

<AMXMLREADNODE XPATH="%fileInfoDS.Value%/BLKSIZE" RESULTVARIABLE="currentBLKSIZE" />

</AMLOOP>

<AMXMLENDSESSION />

For more on AWE XML Actions, refer to "AWE XMLActions" in the Globalscape AWE v10 help content or in the AWE Task Builder in EFT pre-v8.2.

Details
Last Modified: Last Month
Last Modified By: kmarsh
Type: HOWTO
Rated 2 stars based on 5 votes.
Article has been viewed 2.3K times.
Options
Also In This Category