Reading XML

John

Member
Hello Team,

How can I read below XML in a temp table? I tried below code to get code and description but did not work.


DEFINE TEMP-TABLE SupplierMasterResponse
FIELD tt-code AS CHARACTER XML-NODE-NAME "ns1:Code"
FIELD tt-desc AS CHARACTER XML-NODE-NAME "ns1:Description".

TEMP-TABLE SupplierMasterResponse:READ-XML("LONGCHAR",cResponse,"empty",?,?,?,?).




XML:
<ns0:SupplierMasterResponse xmlns:ns0="http://1" xmlns:ns1="http://www./v1">
  <!-- The following element is optional. -->
  <ns0:ResponseMetaData>
    <!-- The following element is optional. -->
    <ns2:Version xmlns:ns2="http:/v1">nonNegativeInteger-value</ns2:Version>
    <!-- The following element is optional. -->
    <ns2:SourceID>string-value</ns2:SourceID>
    <!-- The following element is optional. -->
    <ns2:UserID>string-value</ns2:UserID>
    <!-- The following element is optional. -->
    <ns2:ProgramID>string-value</ns2:ProgramID>
    <!-- The following element is optional. -->
    <ns2:MessageID>string-value</ns2:MessageID>
    <!-- The following element is optional. -->
    <ns2:Environment>string-value</ns2:Environment>
    <!-- The following element is optional. -->
    <ns2:ResponseTimeStamp>dateTime-value</ns2:ResponseTimeStamp>
  </ns0:ResponseMetaData>
  <ns1:Status>
    <!-- The following element is optional. -->
    <ns1:Code name="string-value">normalizedString-value</ns1:Code>
    <!-- The following element is optional. -->
    <ns1:Description>string-value</ns1:Description>
    <!-- The following element is optional. -->
    <ns1:ReasonCode name="string-value">normalizedString-value</ns1:ReasonCode>
  </ns1:Status>
  <!-- The following element may occur 0 or more times. -->
  <ns0:SupplierMstrExceptionDetail>
    <ns1:ID type="normalizedString-value">normalizedString-value</ns1:ID>
    <ns1:ReasonCode name="string-value">normalizedString-value</ns1:ReasonCode>
    <ns1:Reason>string-value</ns1:Reason>
  </ns0:SupplierMstrExceptionDetail>
</ns0:SupplierMasterResponse>
 

Cecil

19+ years progress programming and still learning.
Code:
proenv>xsdto4gl SupplierMasterResponse.xsd
Error reading XML file 'SupplierMasterResponse.xsd'. (13099)
Error while parsing the XML Document: FATAL ERROR: file 'C:\Progress\OpenEdge117/SupplierMasterResponse.xsd', line '7', column '19', message 'prefix 'ns2' can not be resolved to namespace URI'. (13115)
Unable to create Temp-Table or dataset schema from XML Schema. (13032)

Not much luck converting the XSD into ABL code.
 

Cecil

19+ years progress programming and still learning.
Code:
proenv>xsdto4gl SupplierMasterResponse.xsd
Error reading XML file 'SupplierMasterResponse.xsd'. (13099)
Error while parsing the XML Document: FATAL ERROR: file 'C:\Progress\OpenEdge117/SupplierMasterResponse.xsd', line '7', column '19', message 'prefix 'ns2' can not be resolved to namespace URI'. (13115)
Unable to create Temp-Table or dataset schema from XML Schema. (13032)

Not much luck converting the XSD into ABL code.

Do you have a sample XML rather than XSD?
 
Top