290
Annexes
Oocument Type Oeclaration (OTO)
A Document Type Declaration (DTD) declares the valid XML elements, their
structure, and the XML entities that can be used by a class of XML documents. An
XML document can have an external DTD subset defined in a separate file and/or an
internal DTD subset defined as apart of the header information of the XML document. If an XML document contains both an external subset and an internal subset,
the internal sub set is considered to occur before the external sub set. In the following
DTD declarations are given with examples on what instances in the XML document
will look like.
An XML element is declared using the special DTD start tag "Route 66
Here we define an XML element named Road with text as the content model.
This is indicated by the XML reserved keyword "#PCDATA", which is short for
parsed character data. The content model can be empty, a sequence or a choice of
specific child elements, any combination of elements, or a mixture of text and specific child elements. A multiplicity operator can be used to specify the allowed occurrences of the child elements. The multiplicity operators are (?) for zero-or-one,
(+) for one-or-more and (*) for zero-or-more occurrences. Absence ofthe multiplicity operator means that the child element must appear exactly once. Here is an example ofthe use ofmultiplicity operators:
...
...
...
...
The parent XML element shall contain the four child XML elements cl, c2, c3
and c4, in that particular order. The element cl must always occur, c2 is optional,
there can be one-or-more c3 elements and zero-or-more c4 elements. The example
shows one cl, no c2, two c3 and one c4 elements.
An XML element with a choice of child elements is declared as follows:
...
Here a car--part element may contain a door, a wheel or an engine, but not more
than one child element.
Annexes
Oocument Type Oeclaration (OTO)
A Document Type Declaration (DTD) declares the valid XML elements, their
structure, and the XML entities that can be used by a class of XML documents. An
XML document can have an external DTD subset defined in a separate file and/or an
internal DTD subset defined as apart of the header information of the XML document. If an XML document contains both an external subset and an internal subset,
the internal sub set is considered to occur before the external sub set. In the following
DTD declarations are given with examples on what instances in the XML document
will look like.
An XML element is declared using the special DTD start tag "
Here we define an XML element named Road with text as the content model.
This is indicated by the XML reserved keyword "#PCDATA", which is short for
parsed character data. The content model can be empty, a sequence or a choice of
specific child elements, any combination of elements, or a mixture of text and specific child elements. A multiplicity operator can be used to specify the allowed occurrences of the child elements. The multiplicity operators are (?) for zero-or-one,
(+) for one-or-more and (*) for zero-or-more occurrences. Absence ofthe multiplicity operator means that the child element must appear exactly once. Here is an example ofthe use ofmultiplicity operators:
The parent XML element shall contain the four child XML elements cl, c2, c3
and c4, in that particular order. The element cl must always occur, c2 is optional,
there can be one-or-more c3 elements and zero-or-more c4 elements. The example
shows one cl, no c2, two c3 and one c4 elements.
An XML element with a choice of child elements is declared as follows:
Here a car--part element may contain a door, a wheel or an engine, but not more
than one child element.
