Progress 4GL: How to convert an xml serialized table to a dataset?

Status
Not open for further replies.
L

Leonardo Alves

Guest
I am accessing a method of a soap webservice, it is responding me the following result.

<ExportTableDataResponse xmlns="http://sisteplant.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ExportTableDataResult>
<root xmlns="">
<table name="Search">
<r>
<c name="c0">1</c>
<c name="c2">05/09/2014 10:23:00</c>
<c name="c3">05/09/2014 00:00:00</c>
<c name="c5">PRE</c>
<c name="c6">0</c>
<c name="c7">1</c>
<c name="c8">0</c>
<c name="c9">m0000p</c>
<c name="c10">ALM06</c>
<c name="c11">A1</c>
<c name="c12">1,0000</c>
<c name="c13">1000,00000</c>
<c name="c14">PRE</c>
<c name="c15">1</c>
<c name="c17">0</c>
</r>
</table>
</root>
</ExportTableDataResult>



I tried to convert the xml for a dataset using the following code but not work. I using the version 10.2b of progress

DEFINE TEMP-TABLE MessageTypeCode NO-UNDO XML-NODE-NAME 'r'
FIELD NAME AS CHARACTER XML-NODE-TYPE "Attribute"
FIELD ElementValue AS CHARACTER XML-NODE-TYPE "Text"
FIELD c_recid AS RECID XML-NODE-TYPE "Hidden".

DEFINE DATASET ReceiverInfo XML-NODE-NAME 'table'
FOR MessageTypeCode.

DATASET ReceiverInfo:READ-XML("file", "c:\temp\resultado-pesquisa.xml", "empty", ?, FALSE, ?, "IGNORE") NO-ERROR.

FOR EACH MessageTypeCode:
DISP MessageTypeCode.ElementValue FORMAT "X(30)"
MessageTypeCode.NAME
MessageTypeCode.c_recid.
PAUSE.
END.


Then someone has some sujestion how I can convert this xml for a dataset?

Thanks for your help!

Continue reading...
 
Status
Not open for further replies.
Top