Consultor Eletrônico



Kbase P111220: How to specify alternate TEMP-TABLE field names when using READ-XML method?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/6/2009
Status: Verified

GOAL:

How to specify alternate TEMP-TABLE field names when using READ-XML method?

GOAL:

Is it possible to change the XML element names in the TEMP-TABLE or PRODATASET when using the READ-XML, READ-XML-SCHEMA, WRITE-XML and WRITE-XML-SCHEMA methods?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x

FIX:

By default, READ-XML, READ-XML-SCHEMA, WRITE-XML and WRITE-XML-SCHEMA methods, use the the XML node names for the 4GL PRODATASET , TEMP-TABLE, TEMP-TABLE buffer, or TEMP-TABLE buffer-field objects.
If the XML names are OpenEdge reserved words, these methods fail because the FIELD, TEMP-TABLE, or PRODATASET object names can not be OpenEdge reserved words.
To resolve this issue, Progress introduced in OpenEdge 10.1B the XML-NODE-NAME attribute. This attribute returns the name of the XML element or attribute representing the PRODATASET, TEMP-TABLE, TEMP-TABLE buffer, or TEMP-TABLE buffer-field object name in an XML document. This attribute allows developers to work around ABL names that use illegal XML characters or XML element or attribute names that are reserved words in ABL.
For example, the following code snippet shows how to use this attribute when the names of the fields in the XML files are the reserved words "USERID" and "PASSWORD":
DEFINE TEMP-TABLE ttcustomer NO-UNDO
FIELD ttUid AS CHAR LABEL "USERID" XML-NODE-NAME "USERID"
FIELD ttPwd AS CHAR LABEL "PASSWORD" XML-NODE-NAME "PASSWORD".
TEMP-TABLE ttcustomer:READ-XML("file", "myfile.xml", "empty", ?, FALSE).