XML DATA FILE FORMAT

 

XML (Extensible Markup Language) is a set of rules to define semantic labels that organize a document in different parts. XML is a meta-language that defines the syntax to define other structured  label languages.

 

We will explain the XML format to be followed to convert data file correctly:

 

    <? Xml version = "1.0" encoding = "UTF-8" standalone = "yes">


    You can have several attributes, some mandatory and others are not:

version: indicates XML version used in the document. This field is compulsory.

encoding: indicates the way that has been encoded document. The default option is UTF-8, but could be others, as UTF-16, US-ASCII, ISO-8859-1, etc. This field is not obligatory.

standalone: specifies whether further documents, such as a DTD, are required to process the document. The default value is "no".

An entity reference is a placeholder that represents that entity. It consists of the entity's name preceded by an ampersand ("&") and followed by a semicolon (";"). XML has five predeclared entities:

& (ampersand) is &amp;

< (less than) is &lt;

> (greater than) is &gt;

' (apostrophe) is &apos;

" (quotation mark) is &quot;

                                <!- This a comment ->

                                <!- WRONG! NOT WELL-FORMED XML !->

        <p>Normal<em>emphasized<strong>strong emphasized</em>strong</strong></p>          


One XML format valid to Keel is the following:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>

<row1>

<attribute-name-1> attribute-value-11 </attribute-name-1>

<attribute-name-2> attribute-value-12 </attribute-name-2>

<attribute-name-N> attribute-value-1N </attribute-name-N>

</row1>
...
<rowM>

<attribute-name-1> attribute-value-M1 </attribute-name-1>

<attribute-name-2> attribute-value-M2 </attribute-name-2>

<attribute-name-N> attribute-value-MN </attribute-name-N>

</rowM>

</root>

 

 

 Another XML format valid to Keel is the following:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>

<row1>

<field name="attribute-name-1">attribute-value-11 </field>

<field name="attribute-name-2">attribute-value-12 </field>

<field name="attribute-name-N">attribute-value-1N </field>

</row1>
...
<rowM>

<field name="attribute-name-1">attribute-value-M1 </field>

<field name="attribute-name-2">attribute-value-M2 </field>

<field name="attribute-name-N">attribute-value-MN </field>

</rowM>

</root> 

 


One example of a valid XML file is the following:
 

In this example there are:

 

<?xml version="1.0" encoding="UTF-8"?>
<root>

<customer>

<id>5</id>

<course>66</course>

<name>My book</name>

<summary>Book summary</summary>

<numbering>2</numbering>

<disableprinting>0</disableprinting>

<customtitles>1</customtitles>

<timecreated>1114095924</timecreated>

<timemodified>1114097355</timemodified>

</customer>

<customer>

<id>6</id>

<course>207</course>

<name>My book</name>

<summary>A test summary</summary>

<numbering>1</numbering>

<disableprinting>0</disableprinting>

<customtitles>0</customtitles>

<timecreated>1114095966</timecreated>

<timemodified>1114095966</timemodified>

</customer>

</root>

 

The following example has another xml structure, but the same data than the previous example. You can see that there are 9 attributes and 2 instances of this.

 

<?xml version="1.0" encoding="UTF-8"?>
<root>

<row>

<field name="id">5</field>

<field name="course">66</field>

<field name="name">My book</field>

<field name="summary">Book summary</field>

<field name="numbering">2</field>

<field name="disableprinting">0</field>

<field name="customtitles">1</field>

<field name="timecreated">1114095924</field>

<field name="timemodified">1114097355</field>

</row>

<row>

<field name="id">6</field>

<field name="course">207</field>

<field name="name">My book</field>

<field name="summary">A test summary</field>

<field name="numbering">1</field>

<field name="disableprinting">0</field>

<field name="customtitles">0</field>

<field name="timecreated">1114095966</field>

<field name="timemodified">1114095966</field>

</row>

</root>