READ-XML warning

Posted by goo on 14-Sep-2017 01:45

11.3 --> 11.7

Could anyone tell me if this could give us more trouble than just the warning? After upgrading to 11.7 we start getting this error in the appserver log:

Warning: Duplicate XML-NODE-NAME for Value1 and Value2. READ-XML might not work prperly (18544)

We are using a standard XML given from 3. party (we can't change it). We have converted parts of it to temp-table definitions and that gives us the following (part of if):

DEFINE TEMP-TABLE Value1 NO-UNDO NAMESPACE-PREFIX "" XML-NODE-NAME "Value" SERIALIZE-NAME "Value1"
FIELD Value1_Text AS DECIMAL XML-DATA-TYPE "decimal" XML-NODE-NAME "Value1_Text" XML-NODE-TYPE "TEXT" SERIALIZE-NAME "Value1_Text"
FIELD Height_id AS RECID XML-DATA-TYPE "long" XML-NODE-NAME "Height_id" XML-NODE-TYPE "HIDDEN" SERIALIZE-NAME "Height_id"
FIELD Altitude_id AS RECID XML-DATA-TYPE "long" XML-NODE-NAME "Altitude_id" XML-NODE-TYPE "HIDDEN" SERIALIZE-NAME "Altitude_id"
.

DEFINE TEMP-TABLE Value2 NO-UNDO NAMESPACE-PREFIX "" XML-NODE-NAME "Value" SERIALIZE-NAME "Value2"
FIELD Value2_Text AS DECIMAL XML-DATA-TYPE "decimal" XML-NODE-NAME "Value2_Text" XML-NODE-TYPE "TEXT" SERIALIZE-NAME "Value2_Text"
.

As you can see, it is correct warning, but we never got that in the eariler releases. I believe that was probably because of the serialize-name is different then XML-NODE-NAME.

Could we just ignore the warning by using no-error ?

//Geir Otto

All Replies

Posted by Marco Aurelio on 14-Sep-2017 08:31

hi,

  maybe is because both temps have the same XML-NODE-NAME "Value".

   I didnt get any errors when I compiled this, i'm in OpenEdge Release 11.6.3.016

marco aurelio

Posted by Robin Brown on 14-Sep-2017 09:38

This warning was introduced in 11.6.3.  I'm assuming the temp-tables are members of a dataset.  READ-XML() matches the xml-node-name to a temp-table name, and here there are two to choose from.  In 11.6.3+, READ-XML() will choose the first temp-table.  In 12.0.0 READ-XML() is a little smarter in that it looks at the temp-table fields to try to make the right match.

To answer your question about XML-NODE-NAME vs SERIALIZE-NAME:  For XML the value of XML-NODE-NAME is used over SERIALIZE-NAME.  If there is only SERIALIZE-NAME, that is used as XML-NODE-NAME.

Posted by Peter Judge on 14-Sep-2017 09:42

You can probably ignore it but think about what it’s telling you – and that is that there is potential for error/ambiguity in mapping the XML to the temp-tables and fields.

We (ABL) can be smart but only really so smart.
 
If you have very complex XML that doesn’t match well to temp-tables I’d recommend looking at the SAX parser and manually mapping the stuff.

Posted by Robin Brown on 14-Sep-2017 09:51

Forgot to mention that his is a runtime warning issued during WRITE-XML()

Posted by Marco Aurelio on 14-Sep-2017 15:41

hi,

changing to XML-NODE-NAME "Value2" worked fine .

DEFINE TEMP-TABLE Value1 NO-UNDO

          NAMESPACE-PREFIX "" XML-NODE-NAME "Value1" SERIALIZE-NAME "Value1"

                        FIELD Value1_Text AS DECIMAL

                                                              XML-DATA-TYPE   "decimal"

                                                              XML-NODE-NAME "Value1_Text"

                                                              XML-NODE-TYPE "TEXT"

                                                              SERIALIZE-NAME "Value1_Text"

                        FIELD Height_id      AS RECID

                                                              XML-DATA-TYPE    "long"

                                                              XML-NODE-NAME "Height_id"

                                                              XML-NODE-TYPE "HIDDEN"

                                                              SERIALIZE-NAME "Height_id"

                       FIELD Altitude_id     AS RECID

                                                              XML-DATA-TYPE   "long"

                                                              XML-NODE-NAME "Altitude_id"

                                                              XML-NODE-TYPE "HIDDEN"

                                                              SERIALIZE-NAME "Altitude_id".

DEFINE TEMP-TABLE Value2 NO-UNDO

                   NAMESPACE-PREFIX "" XML-NODE-NAME "Value2" SERIALIZE-NAME "Value2"

                        FIELD Value2_Text  AS DECIMAL

                                                              XML-DATA-TYPE   "decimal"

                                                              XML-NODE-NAME "Value2_Text"

                                                              XML-NODE-TYPE "TEXT"

                                                              SERIALIZE-NAME "Value2_Text".

DEFINE    DATASET newvalue for value1, value2.

create value1.

create value2.

dataset newvalue:write-xml("file","test.xml",true,?,?,?,?).

Posted by goo on 14-Sep-2017 23:34

Thx Robin, I will have to check if this has any impect. This part of a rather large and complex xml could be possible to remove. It is not possible to change name, so if the xml-write overwrite the value2 with value1, I will need to rethink how to do this.

It is only this part that gives me "problem" and it is a warning....

It it a bad xml practice to build xml that has this kind of layout?

Posted by Robin Brown on 15-Sep-2017 07:50

No, it is not bad practice.  The issue is with READ-XML() and  knowing which temp-table the XML is meant for.

This thread is closed