Try OpenEdge Now
skip to main content
Working with XML
Reading and Writing XML Data from Temp-Tables and ProDataSets : Using XML Schema : Representing temp-tables in XML Schema
 

Representing temp-tables in XML Schema

Temp-tables are represented with an XML Schema element definition, followed by a complex type definition defining the fields. The XML Schema name attribute identifies the name of the temp-table. The following ABL-specific XML Schema attributes further describe the temp-table:
*undo — Identifies the temp-table as UNDO
*beforeTable — Specifies the name of any before-image table for this temp-table
*bufferName — If the XML Schema is written for a non-default buffer of a temp-table, this attribute specifies the buffer name
Temp-table fields can be represented as elements, attributes, or text in an XML Document. The XML-NODE-TYPE attribute on the buffer-field object lets you control how fields are represented in the XML document and the XML Schema.
Note: The XML-NODE-TYPE attribute interacts with the SERIALIZE-HIDDEN attribute. For more information, see XML-NODE-TYPEand SERIALIZE-HIDDEN.
XML Schema provides the following built-in attributes for minimally describing a temp-table field in an element definition (when the buffer-field has an XML-NODE-TYPE of "ELEMENT"):
*name — Name of the field.
*type — Data type of the field.
*minOccurs — If this is set to 0, then the field is optional and may not appear in the XML document. If the omit-initial-values argument on one of the write methods was used and the current value of an instance is the initial value, then the field is omitted. In this case, the initial value is stored in the xsd:default attribute.
*maxOccurs — Extent of array fields.
*nillable — Can be null or unknown (always has a value of "true" for temp-table fields). Unknown fields have the xsi:nil attribute set to "true" in the XML instance.
*default — The initial value for the field. If the field has the default initial value for it's data type (for example, 0 for integer), the attribute will not be present in the XML Schema.
XML Schema provides the following attributes for attribute definitions (when the buffer-field has a XML-NODE-TYPE of "ATTRIBUTE"):
*name — Name of the field.
*type — Data type of the field.
*default — The initial value for the field. If the field has the default initial value for it's data type (for example, 0 for integer), the attribute will not be present in the XML Schema.
XML Schema provides the following attribute for simple content definitions (when the Buffer-field has a XML-NODE-TYPE of "TEXT"):
*type — Data type of the field.
Note: If you want to be able to explicitly set a field to the Unknown value (?) (xsi:nil="true"), it must have XML-NODE-TYPE = "ELEMENT". Array fields must have XML-NODE-TYPE = "ELEMENT" or "HIDDEN". Buffer fields with XML-NODE-TYPE="TEXT" cannot be part of a nested DATA-RELATION.
ABL provides the following XML Schema extensions for describing ABL-specific attributes of a temp-table field. These attributes, with the exception of dataType and initial, will only appear in the XML Schema when the min-xmlschema option for WRITE-XML( ) method or WRITE-XMLSCHEMA( ) method is FALSE.
Table 27. ABL XML Schema extensions for temp-table fields
XML Schema attribute
Description
caseSensitive
Case-sensitive for CHARACTER fields.
columnCodepage
Column-codepage for CLOB fields.
columnLabel
Column-label for the field.
dataType
The ABL data type for fields where the XML Schema type attribute maps to multiple ABL data types (for example, string, base64Binary, dateTime). See XML Schema and ABL Data Type Mappings.
decimals
Number of decimal places for DECIMAL fields.
format
Display format for the field.
fieldName
Name of the field. It is used for fields with XML-NODE-TYPE of "TEXT". It also identifies the ABL temp-table field name when the corresponding XML element name is different, as defined by the ABL XML-NODE-NAME or SERIALIZE-NAME attributes.
help
Help text for the field.
initial
Initial value for the field. Used for fields with XML-NODE-TYPE of "TEXT", and for fields with initial value of TODAY, NOW or UNKNOWN.
label
Label for the field.
readOnly
Read-only attribute for the field.
userOrder
Position of the field in the temp-table. This attribute is used only when there's a mix of fields with XML-NODE-TYPE of "ELEMENT" and "ATTRIBUTE" in the temp-table.
Note: If any of the above ABL-specific field attributes have the ABL default value, WRITE-XML( ) method and WRITE-XMLSCHEMA( ) method will omit the attribute from the element or attribute definition when it writes the XML Schema.