XML DTD example

This example shows an XML DTD in an XML document and the tree structure form of that document:

<!DOCTYPE test PUBLIC "//this/is/a/URI/test" "test.dtd" [
<!NOTATION TeX  PUBLIC "//this/is/a/URI/TexID" "//TexID">
<!ENTITY ent1 "this is an entity">
<!ENTITY % ent2 "#PCDATA | subel2">
<!ENTITY % extent1 PUBLIC "//this/is/a/URI/extent1" "more.txt">
<!ENTITY extent2 PUBLIC "//this/is/a/URI/extent2" "more.txt">
<!ENTITY unpsd PUBLIC "//this/is/a/URI/me.gif" "me.gif" NDATA TeX>
<?test Do this?>
<!--this is a comment-->
<!ELEMENT subel2 (#PCDATA)>
<!ELEMENT subel1 (subel2 | el4)+>
<!ELEMENT el1 (#PCDATA)>
<!ELEMENT el2 (#PCDATA | subel2)*>
<!ELEMENT el3 (#PCDATA | subel2)*>
<!ELEMENT el4 (#PCDATA)>
<!ELEMENT el5 (#PCDATA | subel1)*>
<!ELEMENT el6 (#PCDATA)>
<!ATTLIST subel1 
	size (big | small) "big" 
	shape (round | square) #REQUIRED>
<!ATTLIST el5 
	el5satt CDATA #IMPLIED>
]>
When a message is parsed by the generic XML parser, the relevant part of the message tree looks like this (assuming that there are no carriage returns or white space between tags):
The graphic shows an example of an XML DTD tree structure
The IntSubset structure contains the following structures at the next level of nesting: the tree structure for each of these is shown in the following tree structures.
The graphic shows an example of a NotationDecl tree structure
The graphic shows an example of an EntityDecl tree structure
The graphic shows an example of a ParameterEntityDecl tree structure
The graphic shows an example of an ExternalParameterEntityDecl tree structure
The graphic shows an example of a ExternalEntityDecl tree structure
The graphic shows an example of an UnparsedEntityDecl tree structure
The graphic shows an example of a DocTypeWhiteSpace tree structure
The graphic shows an example of a DocTypePl tree structure
The graphic shows an example of a DocTypeComment tree structure
The graphic shows an example of an ElementDef tree structure
The graphic shows an example of an ElementDef tree structure named subel1
The graphic shows an example of an ElementDef tree structure named el1
The graphic shows an example of an ElementDef tree structure named el2
The graphic shows an example of an ElementDef tree structure named el3
The graphic shows an example of an ElementDef tree structure named el4
The graphic shows an example of an ElementDef tree structure named el5
The graphic shows an example of an ElementDef tree structure named el6
The graphic shows an example of an AttributeList tree structure named Subel1
The graphic shows an example of an AttributeList tree structure named el5