XML-read and multiple levels in xml-file - Forum - OpenEdge Development - Progress Community

XML-read and multiple levels in xml-file

 Forum

XML-read and multiple levels in xml-file

This question is not answered

Hi,

Not sure if it can be done but I want to use read-xml and get all the data from a xml into 1 Temp-Table.
I know I can create 2 TT's and put the data in there but here I prefer 1 TT with the data.

Example xml-file:
<?xml version="1.0" encoding="utf-8"?>
<MatrixPostingRequest>
  <PostingRequestKey>1481723547567</PostingRequestKey>
 </MatrixPostingRequest>

Example read-xml
define temp-table ttPosting no-undo /* xml-node-name "MatrixPostingRequest" */ serialize-name "MatrixPostingRequest"   
  field NRkey            as int64 serialize-name "PostingRequestKey"

This works fine

My problem is whan the xml has 2 levels like
<?xml version="1.0" encoding="utf-8"?>
<MatrixPostingRequest>
  <PostingRequestKey>1481723547567</PostingRequestKey>
  <Dispense>
    <MeterName>METER1</MeterName>
  </Dispense>
</MatrixPostingRequest>

How must I define my TT-fields so the read-xml will read the value of the MeterName??
I tried this (and many other combinations but nothing seems to work (or can't this be done with a simple read-xml))
define temp-table ttPosting no-undo serialize-name "MatrixPostingRequest"   
  field NRkey            as int64 serialize-name "PostingRequestKey"
  field NMmeter        as character serialize-name "MeterName".


regards



All Replies