0.33.1.1: Example of an XML document and its DTD

The following example shows the state.xml document and its DTD:

state.xml state.dtd
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE state SYSTEM "state.dtd">
<state stateid="MN">
<city cityid="mn12">
<name>Johnson</name>
<population>5000</population>
<country/>
</city>
<city cityid="mn15">
<name>Pineville</name>
<population>60000</population>
<country/>
</city>
<city cityid="mn20">
<name>Lake Bell</name>
<population>20</population>
<country/>
</city>
</state>
<!ELEMENT state (city)+ >
<!ATTLIST state stateid ID #REQUIRED>

<!ELEMENT city (name, population?, numpeople?, country)>
<!ATTLIST city cityid ID #IMPLIED>

<!ELEMENT name (#PCDATA)>
<!ELEMENT population (#PCDATA)>
<!ELEMENT numpeople EMPTY>
<!ATTLIST numpeople id ID #REQUIRED>
<!ELEMENT country (#PCDATA)>
<!ATTLIST country countryid ID #FIXED "US">