We shall exclude attributes, because diputree doesn't use them.
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.
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>.
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/>.
An XML document is a tree structure (a-cyclical graph), starting from the document element.
e.g <root><child><grandchild/></child></root>
An element can contain text. This text can be mixed with other elements.
e.g <ocean>
Pacific</ocean>
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.
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.
http://www.w3.org/XML/ and http://www.w3.org/TR/REC-xml