Feedback
Did this article resolve your question/issue?

   

Article

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/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

 
Last Modified Date11/13/2020 7:01 AM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.