I have an XML I am trying to process using read-xml into a prodataset. The process runs successfully but when I access the temp-tables they are empty. I cannot determine what is causing this. I have used similar code with success in the past.
Sample XML
My code
Let me know what I might be doing wrong.
Sample XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<req:ResponseMsg xmlns:req="http://api-v1.gen.mm.vodafone.com/mminterface/request"><![CDATA[<?xml version="1.0" encoding="UTF-8"?><response xmlns="http://api-v1.gen.mm.vodafone.com/mminterface/response"><ResponseCode>0</ResponseCode><ServiceStatus>0</ServiceStatus></response>]]></req:ResponseMsg>
</soapenv:Body>
</soapenv:Envelope>
My code
define variable vmfile as memptr no-undo.
define variable vlcfile as longchar no-undo.
define variable hEnvelop as handle no-undo.
define variable vlreturn as logical no-undo.
define temp-table ttBody xml-node-name "soapenv:Body"
field id as integer serialize-hidden.
define temp-table ttResponseMsg xml-node-name "req:ResponseMsg"
field id as integer serialize-hidden
field ResponseMsg as character xml-node-type "text".
define dataset dsEnvelop namespace-prefix "soapenv"
xml-node-name "Envelope"
FOR ttBody,
ttResponseMsg
data-relation r01 for ttBody, ttResponseMsg relation-fields (id, id) nested.
file-info:file-name = "sample.xml".
set-size(vmfile) = file-info:file-size.
input from value(file-info:file-name) binary no-map no-convert.
import vmfile.
input close.
copy-lob from vmfile to vlcfile.
hEnvelop = dataset dsEnvelop:handle.
/* this is a debug message */
message "vlcfile -> " string(vlcfile) view-as alert-box.
vlreturn = hEnvelop:read-xml("longchar",
vlcfile,
"empty",
?,
no) no-error.
/* this is a debug message */
message "vlreturn -> " vlreturn view-as alert-box.
/* temp-tables are empty */
for each ttBody:
display ttBody.
end.
/* temp-tables are empty */
for each ttBody:
display ttBody.
end.
Let me know what I might be doing wrong.