Search

GlobalSCAPE Knowledge Base

How do I read an XML file in AWE?

rrgf0rz3
EFT

THE INFORMATION IN THIS ARTICLE APPLIES TO:

  • EFT version 6.5 and later

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 />

Refer to the following topics for more information:

Details
Last Modified: Last Month
Last Modified By: kmarsh
Type: HOWTO
Article not rated yet.
Article has been viewed 1.1K times.
Options
Also In This Category