2.10.3.3 Mapping XML To and From FML/FML32 Field Types

The relationship between the XML format and the FML/FML32 fields is one in which the XML element names are the same as the FML/FML32 field names, and the XML values are interpreted using the corresponding field type.

The opening and closing tag uses the name of the field. Attributes are optionally provided for FLD_FML32, FLD_MBSTRING and FLD_VIEW32. Field names and attributes are case sensitive.

The field value is read as a string and converted to the following field type:

<FIELDNAME Attribute="Attribute Value"> FIELDVALUE </FIELDNAME>

FML/FML32 field types are mapped to XML buffer types as follows:

Field Type Conversion Mapping Example
SHORT LONG CHAR FLOAT DOUBLE STRING The FLD_SHORT, FLD_LONG, FLD_CHAR, FLD_FLOAT, FLD_DOUBLE, and FLD_STRING fields are simple conversions to and from the XML string values. Formatting of type values will follow the style, where possible, that has been used in Ftypcvt().
FML:AMOUNT=10.00
XML:<AMOUNT>10.00</AMOUNT>
CARRAY During FLD_CARRAY field conversion, the XML byte stream value is converted from two alphanumeric characters in XML to one byte value in Tuxedo. That is, each XML pair of characters represents a hex byte value.
FML: Oracle=TUXEDO
XML:<ORACLE>54555845444F</ORACLE>
PTR During conversion to XML, the FLD_PTR fieldname points to one of the following valid Tuxedo buffer types: STRING, MBSTRING, CARRAY, FML, FML32, and VIEW32 and ignores any invalid buffer types. When the buffer content is converted to XML, the BUFTYPE attribute is included in the buffer type tag (see example 1). During conversion to FML32, the BUFTYPE attribute must be included in the buffer type tag. The only valid values are Tuxedo buffer types: STRING, MBSTRING, CARRAY, FML,FML32, and VIEW32. If the BUFTYPE attribute is not specified or an invalid value is used, the element is ignored in FML32. Example 1 - XML Conversion:
<stringptr
BUFTYPE=”STRING”>teststringptr
</stringptr>
Example 2 - FML32 Conversion:
<fml32ptr
BUFTYPE=”FML32”><id>2323</id>
</fml32ptr>
FML32 The FLD_FML32 fieldname is supported with the opening and closing tags based upon the FML field name. This XML document includes multiple descriptions of <fieldname>value</fieldname> for each field contained in the buffer. Embedded FML32 is allowed so hierarchical XML descriptions are permitted.

Note:

An optional attribute, Tpmbenc, can be used to specify the encoding for the entire MBSTRING field of FML32 buffers during XML to FML32 conversion
The first example below includes an encoding attribute and the second example is an FML32 definition for a BANK field containing an embedded FML32 field named ID.
Example 1:
<ACCT Tpmbenc="EUC"><NM>Smith</NM><TRAN>OPEN</TRAN></ACCT>

Example 2: <BANK><BID>001</BID><ID><NM>Jones</NM><AC>001</AC></ID></BANK>

VIEW32 The FLD_VIEW32 fieldname is supported, and therefore, the FLD_INT and FLD_DECIMAL fields are also recognized. FLD_INT is treated like FLD_LONG. The start and end tag is based on the FLD_VIEW32 field name. It will take a Vname attribute for specifying the view name to use. This XML document includes multiple descriptions of <fbname> value </fbname> where fbname is the buffer name of the view member field.
<CURR Vname="Myview">
<FB1>001</FB1><FB1>002</FB1><FB2>7.50</FB2><FB3>Y</FB3> 
</CURR>
MBSTRING The FLD_MBSTRING field conversion uses the Encoding attribute and the field data to describe the FML32 field. This conversion is similar to Fmbpack32 usage. Please note the following conditions:
  1. If the Encoding attribute is present and the value is specified, the data values are used to create the FLD_MBSTRING value.
  2. If the Encoding attribute is not present and Tpmbenc has been set for the full FML32 buffer, then the FLD_MBSTRING adopts the Tpmbenc value.
  3. If the Encoding attribute is not present and Tpmbenc is not specified, then an attempt is made to get the process environment TPMBENC (all caps) and use that encoding as the FLD_MBSTRING value in place of the attribute definition.
  4. If all three of the previous conditions are not met, Tuxedo ignores those elements and no conversion takes place.
Data is treated in the same manner as a FLD_CARRAY field.
<MBIN Encoding="SJIS">C7E8D9CAB3</MB
IN>