AnsweredAssumed Answered

Parsing and Loading an XML File via GEL

Question asked by derrickat on Aug 11, 2014
Latest reply on May 13, 2015 by gcubed

I am building an integration with another system. I've done tons via SQL and .csv, but I've never tried to parse and load an xml file. I've included a sample xml file that resides on a shared drive and I can easily read. I have the java to find the location/file. The problem is parsing.


Here is the sample:

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



                                <header:Name>CA Technologies</header:Name>


                                <header:Title>XML File Parse</header:Title>









Here is what I traditionally use for csv:


<core:catch var="filerr">

  <file:readFile commentIndicator="#" delimiter="," embedded="false" fileName="${wrkDir}/${wrkFile}" var="input"/>



  <core:when test="${filerr != null}">

  <gel:log level="ERROR">Error: ${fileerr}.  Check input File. "${wrkDir}/${wrkFile}"</gel:log>





            <core:forEach begin="1" indexVar="i" items="${input.rows}" step="1" var="row">

            <!-- Start of CSV Variables-->



  <core:set value="${row[0]}" var="record_type"/>

  <core:set value="${row[1]}" var="id"/>

  <core:set value="${row[2]}" var="segment_date"/>

  <core:set value="${row[3]}" var="segment_amount"/>

  <core:set value="${row[4]}" var="time_stamp"/>


From here, I have them in variables and can xog into the staging object, yada, yada, away we go. But how do I do the same with an XML file instead of a csv?

Thanks for the help.