Salesforce

How to read an XML in a temp-table using READ-XML

« Go Back

Information

 
TitleHow to read an XML in a temp-table using READ-XML
URL NameHow-to-read-an-XML-in-a-temp-table-using-READ-XML
Article Number000172860
EnvironmentProduct: OpenEdge ABL
Version: All supported versions
OS: All supported platforms
Other: XML
Question/Problem Description
When trying to read an XML string into a temp-table using the READ-XML() method it may not create the correct structure and would cause an incorrect temp-table to be created.


 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
When having XML Documents or XML Schemas which are being imported through ABL, the XML-NODE-NAME or SERIALIZE-NAME attributes on a ProDataSet object handle, temp-table object, temp-table buffer object, or buffer field object allow you to specify an XML element (or attribute) name for the ABL object.

Following an example on how to achieve this:

Consider having an XML string like following: "<A><B>Red</B><B>Green</B></A>", which contains no additional info.

The goal is to have a temp-table (buffer name A) which has 1 field (B) and 2 records ("Red" and "Green").
Use the READ-XML method as follows:
 
DEFINE VARIABLE lcc AS LONGCHAR INIT "<A><B>Red</B><B>Green</B></A>". 

DEFINE TEMP-TABLE ttb SERIALIZE-NAME "B" 
    FIELD cc AS CHAR XML-NODE-TYPE "text". 

DEFINE DATASET dsa SERIALIZE-NAME "A" FOR ttb. 

DATASET dsa:READ-XML( "longchar", lcc, ?, ?, ? ). 

FOR EACH ttb: 
    MESSAGE ttb.cc VIEW-AS ALERT-BOX. 
END.



 
Workaround
Notes
References to Other Documentation:

Progress Information Hub, Use XML with ABL Applications, Read and Write XML Data from Temp-Tables and ProDataSets:
https://docs.progress.com/bundle/openedge-abl-use-xml/page/Read-and-Write-XML-Data-from-Temp-Tables-and-ProDataSets.html

 
Keyword Phrase
Last Modified Date11/13/2020 7:01 AM

Powered by