XML
(Extended Markup Language)


We shall exclude attributes, because diputree doesn't use them.

The document element

This is the root of the hierarchy. All other elements are directly or indirectly contained within the document element.

There can only be one document element per document.

The elements

Elements have a name, a start tag and an end tag.

e.g. <age>27</age>

The name of the element is age, the start tag is <age> end the end tag is </age>.

The empty element

This is a special element where the start and the end tag are folded together.

e.g. <present/>

The name of the element is present, the start tag and the end tag are folded together in <present/>.

Elements can contain other elements

An XML document is  a tree structure (a-cyclical graph), starting from the document element.

e.g <root><child><grandchild/></child></root>

Elements can contain text

An element can contain text. This text can be mixed with other elements.

e.g <ocean>Pacific</ocean>

Elements must nest properly

It is illegal to close an element when there are still contained elements which are open.

e.g. <first><second></first></second>

This is illegal, first can not close itself before second has closed itself.

An XML document can be restraint by a DTD

All the rules explained so far are all well formedness rules. The document type definition (DTD) defines validity rules for the document.

A DTD defines for example the name of the document element, which elements can contain which elements, etc...

Roughly speaking the DTD defines the SEMANTIC RULES which apply to the document and its elements.

More information

http://www.w3.org/XML/ and http://www.w3.org/TR/REC-xml


diputree documentation © 2000 dipu