602SQL Documentation Index  

XML Programming Interface

Import and Export

The Import_from_XML function imports XML data from a text file to the database. The Import_from_XML_CLOB function imports data from a variable to the database.

The Export_to_XML function exports data from a database to a text XML file. The Export_to_XML_CLOB function exports data to a variable from the database.

XML extension

The 602xml server extension must be loaded on the SQL Server before calling XML functions from the SQL language. This is done automatically on Windows, but you must manually load it on Linux by executing the following:

IF Load_server_extension('602xml') THEN _use_XML_API ...
The function will return TRUE if loading was successful. The folder with the lib602xmlXX.so library (/usr/lib/602sqlXX by default) must be on the library folder list.

Dynamic DAD

XML file operations require a DAD that describes XML database mapping. This file is passed as a parameter to the export and import functions.

If the DAD is stored as a database object, it will be passed as a character string that contains an asterisk and the DAD name (e.g. *cutomerRegistrationDAD).

You may also pass the DAD directly. If the parameter specifying the DAD does not begin with an asterisk, it will be considered as DAD notation.


Errors of various types may occur when executing XML functions. Database errors (e.g. duplicity during import), incorrect XML or DAD structure, file read errors, etc. More information about XML errors and handling can be found here.

XML API Support in Other Interfaces

Developers using PHP may use a similar set of client functions wb_export_to_XML, wb_export_to_XML_buffer, wb_import_from_XML and wb_import_from_XML_buffer.

List of topics: