602SQL Documentation Index  

Format of Elementary Data in XML Files

The XML extension will import/export elementary data notation using the formats described below (if formats are not specified by the DAD from the XML text properties or XML attribute properties dialog).

A NULL value in the database is equivalent to an empty item in XML.

If an application requires data transfer in different formats, an explicit conversion from/to character strings must be performed.

Character Data

Character data (including CLOBs) are transferred without changes between a database and an XML file. The text layout in lines are preserved. If the character coding differs between the database and the XML file, the conversion is done during the transfer.

Decimal Numbers

The decimal dot character is used to separate decimal places for the REAL and NUMERIC types by default (independent of the local settings decimal separator). This may be changed in the DAD.

Real numbers are exported in decimal or semilogarithmic notation. Both formats are accepted during import.

Binary Data

BASE64 coding is used when writing binary data from a database to an XML file. This coding uses letter from the English alphabet, numbers, characters "+", "/" and "=". The major advantage of this coding is the fact that the binary data cannot be damaged during translation to different national alphabets. The binary data will take up more storage space in the XML file than in the database.

Binary data with fixed length is appended with zeros. Binary data with variable length preserve their original length on import and export.

Encoded data is converted back to original notation during import.

Since BASE64 coding is an Internet standard (PEM, RFC 1421), the XML file should be portable to other systems.

Binary data may be coded in hex form. This coding uses numbers and letters A through F. Each byte is represented with two characters. Specify the Hex format to use this coding method.

Date and Time

The XML extension (by default) works with the date and time representation in the XML file according to the specification of the simple data type date, time and dateTime from XSD:

time: 23:59:59[.000][+02:00]
date: 2003-12-31
timestamp: 2003-12-31T23:59:59[+02:00]

The time zone is accepted when specified with the date on input, but 602SQL will ignore this value.

The date format can be set for individual elements.


Logical values represented in XML as true and false according to the specification of the simple type Boolean from XSD.

Specifying custom native data formats

You may specify your own custom native data format. All formats are specified in the single edit field called Format.

Native format for BOOLEAN type

The format notation is composed of two strings separated by a comma. The first string represents the FALSE value, the second represents TRUE.

Native format for REAL type

The format notation is composed of a string with four parts. The first character is the decimal separator, the second character (optional) is the thousands separator, followed by the decimal place count, and the E or F character for semilogarithmic or decimal notation (e.g comma as the decimal separator, blank space as the thousands separator, and 10 decimal places use the string: , 10F).

Native format for NUMERIC type

The format notation is a single character that specifies the decimal separator.

Native format for DATE type

The format notation is a string representing the format: D for day, M for month, Y for year, MM for leading zeros, other characters are used as separators (e.g. the format for 2004-08-25 is YYYY-MM-DD).

Native format for TIME type

The format notation is a string representing the format: h for hours, m for minutes and s for seconds, all characters in lowercase (e.g. the format for 12:00:01 is hh:mm:ss).

Native format for TIMESTAMP type

The format notation is a string representing the format: D for day, M for month, Y for year, h for hours, m for minutes and s for seconds (e.g. the format for 2004-08-25 12:00:01 is YYYY-MM-DD hh:mm:ss).

General Transformation

If the needed format is so different that it cannot be created or analyzed using the above tools, a general conversion using an SQL function (Translation button in the XML text properties and XML attribute properties dialogs) must be used.