Consultor Eletrônico



Kbase P132845: READ-XML reads data from XML document twice
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/07/2008
Status: Unverified

SYMPTOM(s):

READ-XML reads data from XML document twice

Outer node has the following attributes: xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" soapenc:arrayType="<type-name>[<limit>]" xsi:type="soapenc:Array" (It is a soap-encoding array)

Data elements are read into temp-table twice

A blank row is read into the temp-table

FACT(s) (Environment):

XML is a SOAP envelope containing a response from a WebService call
Document raises errors when READ-XML is called for an unprepared dynamic temp-table
OpenEdge 10.1x
All Supported Operating Systems
OpenEdge Category: Language (4GL/ABL)

CAUSE:

The READ-XML method can not handle all complex XML types.

Generally speaking, if the document was not originally created by the WRITE-XML method, or not based on a schema generated with the WRITE-XMLSCHEMA method the READ-XML can not be guaranteed to be able to parse the data correctly.

FIX:

Two possible approaches to read the XML document:

1. Manually parse the XML document using the DOM tree (X-DOCUMENT and X-NODEREF objects) or the SAX-READER.

2. Generate an XSD schema that the ABL can parse using the WRITE-XMLSCHEMA method. Then use an intermediate XML transformation service to transform the XML document to that schema before it reaches the ABL application.