There are a few issues that I noticed with your attempt.
The first thing I noticed is that it doesn't look like you know how to use the occurrence indicators correctly. You have country
defined as (language?, city?)
which means zero or one language
followed by zero or one city
. This is not what appears in the data. Sometimes there are no city/language elements and sometimes there are more.
I also noticed that you are not closing a few of your declarations with >
properly (an example is the declaration for country
).
Also, this is invalid:
<!ELEMENT city CDATA #IMPLIED>
It looks like an element declaration and an attribute declaration had a baby. ;-)
Here's an example of a DTD that works that you can use for reference:
<!ELEMENT countries (country)+>
<!ELEMENT country (city*,language*)>
<!ATTLIST country
area CDATA #REQUIRED
name CDATA #REQUIRED
population CDATA #REQUIRED>
<!ELEMENT city (name,population)>
<!ELEMENT language (#PCDATA)>
<!ATTLIST language
percentage CDATA #REQUIRED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT population (#PCDATA)>
Here's a shortcut to a quickref that will help a lot with DTD syntax: http://www.mulberrytech.com/quickref/XMLquickref.pdf