ObjectGears Help

           
Forum   ObjectGears (Version: 1.6.0.0)

Import format XML

It is a commonly used format for data transfers. Particular records and columns are represented by means of a hierarchical structure of xml elements.

You can set various parameters of the import file in the import definition, These will be described hereinafter.

File coding

The import file can be in whatever code page. In order the import works well you have to choose the code page correctly. Otherwise, there can be an error caused by the import.

XML structure of the import file

In order the import works well, it is necessary that each record is contained in one element and particular columns in another nested elements.

The path to each element has to be defined in the field XML path to item.

There can be other data in the XML file, that will not be imported. The import pays attention only to data, that shall be imported.

XML is case sensitive.

The example hereinafter shows import of three records with columns name, number and type. The value for field XML path to item will be set to /datas/data (including the initial slash!).

<?xml version="1.0" encoding="utf-8"?>
<datas>
  <data>
    <name>Tom</name>
    <number>11</number>
    <type>A</type>
  </data>
  <data>
    <name>Charles</name>
    <number>12</number>
    <type>A</type>
  </data>
  <data>
    <name>John</name>
    <number>130</number>
    <type>C</type>
  </data>
</datas>

In case of XML import numbering of columns like at CSV import cannot be used.

Column mapping

Mapping of columns from the class, into which you import, to columns from the import file is performed in the import definition. Mapping is done by entering the column name into the field Import column at the appropriate class column. One column from the import file may be mapped to more columns from the class.

Order of the columns in the class and in the file does not matter. You can have more columns in the impotrt file, that will be ignored at the actual import. This enables to use one import file for more imports. E.g. you can import values into a referenced class by using import property Import unique records and then own data into another class that refers to the first class.

 

Section CDATA

There can be characters in some CML elements that can disrupt XML format and import could not be performed. These are e.g. characters   <   or    >   . In this case element content can be enclosed in section CDATA. It is a standard XML technique.

Example:

<data>
<![CDATA[
...here is dangerous content.
]]>
</data>

 

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information