Read .propath.xml file

Posted by Patrick Tingen on 27-Nov-2015 01:48

I want to read the .propath.xml file into a temp-table but either my caffeine is too low or I am blunt stupid, but for the life of me I cannot figure out how to read a file like this:

<?xml version='1.0' encoding='UTF-8' standalone='no'?>

<propath version='11.3' xmlns:xsi='www.w3.org/.../XMLSchema-instance' xsi:noNamespaceSchemaLocation='schema/propath.xsd'>
<propathentry env='all' kind='src' path='@{ROOT}' platform='All'/>
<propathentry env='all' kind='dir' path='\\nljrsr20\netapps\ea2008\ontw\local\cprs' platform='Windows'/>
<propathentry env='all' kind='dir' path='\\nljrsr20\netapps\ea2008\ontw\local\core' platform='Windows'/>
</propath>

into a temp-table structure.

Posted by Mark Davies on 27-Nov-2015 02:39

This should get you going:

DEFINE TEMP-TABLE ttPropath NO-UNDO XML-NODE-NAME "PropathEntry"

   FIELD env      AS CHARACTER XML-NODE-TYPE "ATTRIBUTE"

   FIELD kind     AS CHARACTER XML-NODE-TYPE "ATTRIBUTE"

   FIELD path     AS CHARACTER XML-NODE-TYPE "ATTRIBUTE"

   FIELD platform AS CHARACTER XML-NODE-TYPE "ATTRIBUTE".

/* Just change it to your full .propath locction */

TEMP-TABLE ttPropath:READ-XML("FILE",".propath","EMPTY",?,?,?,"IGNORE").

FOR EACH ttPropath:

   DISPLAY

     ttPropath.env

     ttPropath.kind

     ttPropath.path

     ttPropath.platform.

END.

All Replies

Posted by Mark Davies on 27-Nov-2015 02:39

This should get you going:

DEFINE TEMP-TABLE ttPropath NO-UNDO XML-NODE-NAME "PropathEntry"

   FIELD env      AS CHARACTER XML-NODE-TYPE "ATTRIBUTE"

   FIELD kind     AS CHARACTER XML-NODE-TYPE "ATTRIBUTE"

   FIELD path     AS CHARACTER XML-NODE-TYPE "ATTRIBUTE"

   FIELD platform AS CHARACTER XML-NODE-TYPE "ATTRIBUTE".

/* Just change it to your full .propath locction */

TEMP-TABLE ttPropath:READ-XML("FILE",".propath","EMPTY",?,?,?,"IGNORE").

FOR EACH ttPropath:

   DISPLAY

     ttPropath.env

     ttPropath.kind

     ttPropath.path

     ttPropath.platform.

END.

Posted by Patrick Tingen on 27-Nov-2015 03:52

Hi Mark,

Thanks, works like a charm. I could have sworn that my program looked exactly like your proposal, but then again: caffeine level /was/ low.

This thread is closed