TIBCO EBX®
Documentation > Reference Manual > Integration > File import and export services
Navigation modeDocumentation > Reference Manual > Integration > File import and export services

XML import and export

Introduction

XML imports and exports can be performed on tables through the user interface using the Actions menu in the workspace.

Both imports and exports are performed in the context of a dataset.

Imports and exports can also be done programmatically.

Default import and export option values can be set in the Administration area, under User interface > Graphical interface configuration > Default option values > Import/Export.

Imports

Attention

Imported XML documents must be encoded in UTF-8 and its structure must conform to the underlying data model of the target dataset.

Import mode

When importing an XML file, you must specify one of the following import modes, which will dictate how the import procedure handles the source records.

Insert mode

Only record creations are allowed. If a record exists in the target table with the same primary key as the source record, an error is returned and the whole import operation is cancelled.

Update mode

Only modifications of existing records are allowed. If no record exists in the target table with the same primary key as the source record, an error is returned and the whole import operation is cancelled.

Update or insert mode

If a record with the same primary key as the source record already exists in the target table, that record is updated. Otherwise, a new record is created.

Replace (synchronization) mode

If a record with the same primary key as the source record already exists in the target table, that record is updated. Otherwise, a new record is created. If a record exists in the target table but is not present in the source XML file, that record is deleted from the table.

Insert and update operations

The mode 'by delta' allows ignoring data model elements that are missing from the source XML document. This mode can be enabled through data services or the Java API. The following table summarizes the behavior of insert and update operations when elements are not present in the source document.

See the data services operations update and insert, as well as ImportSpec.setByDelta in the Java API for more information.

State in source XML document

Behavior

Element does not exist in the source document

If 'by delta' mode is disabled (default):

Target field value is set to one of the following:

  • If the element defines a default value, the target field value is set to that default value.

  • If the element is of a type other than a string or list, the target field value is set to null.

  • If the element is an aggregated list, the target field value is set to an empty list.

  • If the element is a string that distinguishes null from an empty string, the target field value is set to null. If it is a string that does not distinguish between the two, an empty string.

  • If the element (simple or complex) is hidden in data services, the target value is not changed.

Note: The user performing the import must have the permissions necessary to create or change the target field value. Otherwise, the value will remain unchanged.

If 'by delta' mode has been enabled through data services or the Java API:

  • For the update operation, the field value remains unchanged.

  • For the insert operation, the behavior is the same as when byDelta mode is disabled.

Element exists but is empty (for example, <fieldA/>)

  • For nodes of type xs:string (or one of its sub-types), the target field's value is set to null if it distinguishes null from an empty string. Otherwise, the value is set to empty string.

  • For non-xs:string type nodes, an exception is thrown in conformance with XML Schema.

Element is present and null (for example, <fieldA xsi:nil="true"/>)

The target field is always set to null except for lists, for which it is not supported.

In order to use the xsi:nil="true" attribute, you must import the namespace declaration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance".

Set missing values as null

When updating existing records, if a node is missing or empty in the XML file: if this option is "yes", it will be considered as null. If this option is "no", it will not be modified.

Ignore extra columns

It may happen that the XML document contains elements that do not exist in the target data model. By default, in this case, the import procedure will fail. It is possible, however, to allow users to launch import procedures that will ignore the extra columns defined in the XML files. This can be done in the configuration parameters of the import wizard for XML. The default value of this parameter can be configured in the 'User interface' configuration under the 'Administration' area.

Optimistic locking

If the technical attribute ebxd:lastTime exists in the source XML file, the import mechanism performs a verification to prevent an update operation on a record that may have changed since the last read. In order to use the ebxd:lastTime attribute, you must import the namespace declaration xmlns:ebxd="urn:ebx-schemas:deployment_1.0. The timestamp associated with the current record will be compared to this timestamp. If they are different, the update is rejected.

Exports

Note

Exported XML documents are always encoded in UTF-8.

When exporting to XML, if the table has filters applied, only the records that correspond to the filter are included in the exported file.

The XML export options are as follows:

Download file name

Specifies the name of the XML file to be exported. This field is pre-populated with the name of the table from which the records are being exported.

User-friendly mode

Specifies whether exported values will be represented in a user-friendly way, or in the standard XML raw format. For example, in user-friendly mode, dates and numbers are formatted according to the user's locale, and foreign keys and enumerated values display their associated labels.

Note: If this option is selected, the exported file will not be able to be re-imported.

Include technical data

Specifies whether internal technical data will be included in the export.

Note: If this option is selected, the exported file will not be able to be re-imported.

Is indented

Specifies whether the file should be indented to improve its readability by a human.

Omit XML comment

Specifies whether the generated XML comment that describes the location of data and the date of the export should be omitted from the file.

Handling of field values

Date, time & dateTime format

The following date and time formats are supported:

Type

Format

Example

xs:date

yyyy-MM-dd

2007-12-31

xs:time

HH:mm:ss or HH:mm:ss.SSS

11:55:00

xs:dateTime

yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:ss.SSS

2007-12-31T11:55:00

Known limitations

Association fields

The XML import and export services do not support association values.

Exporting such fields will not cause any error, however, no value will be exported.

Importing such fields will cause an error, and the import procedure will be aborted.

Selection nodes

The XML import and export services do not support selection values.

Exporting such fields will not cause any error, however, no value will be exported.

Importing such fields will cause an error, and the import procedure will be aborted.

Documentation > Reference Manual > Integration > File import and export services