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.
Imported XML documents must be encoded in UTF-8 and its structure must conform to the underlying data model of the target dataset.
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. |
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:
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:
|
Element exists but is empty (for example, |
|
Element is present and | The target field is always set to In order to use the |
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.
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.
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.
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. |
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 |
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.
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.