KickStart Tutorial XML by Jan Kampherbeek - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

XML documents

The XML declaration

The first line of an XML document is the XML declaration.
It's a special kind of tag:
<?xml version="1.0"?>

The version 1.0 is the actual version of XML.
The XML declaration makes clear that we're talking XML and also which version is used.
The version identification will become important after new versions of XML are used.

The root element

All XML documents must have a root element.
All other elements in the same document are children of this root element. The root element is the top level of the structure in an XML document.

Structure of an XML page

<?xml version="1.0"?>

 

<root>

 

<element>

<sub-element>
content
</sub-element>
<sub-element>
content
</sub-element>
element>
</root>
All elements must be nested. The level of nesting can be arbitrarily deep.

A real XML page

<?xml version="1.0"?>

 

<sales>

 

<shop>

 

<number>

100
</number>
<manager>

Ray Bradbury </manager>
</shop>
<product>

<name>
carrots
</name>
<totalprice>
10
</totalprice>
</product>
</sales>