John Rock
John Rock

Reputation: 133

DTD validity error

I'm studying some SQL and DTD on my own. I'm not used to it too much. While making some exercise I'm running into some problems. Here is the data : https://prod-c2g.s3.amazonaws.com/db/Winter2013/files/countries.xml I'm trying to write DTD for that. Here what I wrote:

<!ELEMENT countries (country*)>
<!ELEMENT country (city*, population*)>
<!ATTLIST country name (PCDATA) #REQUIRED population (CDATA) #REQUIRED area (CDATA) #REQUIRED >
<!ELEMENT city (name, population) >
<!ELEMENT name ANY>
<!ELEMENT population ANY>
<!ELEMENT language ANY>
<!ATTLIST language percentage CDATA #IMPLIED >

There may be some minor errors but the error I constantly get is validity error. For example it says

Value "Afghanistan" for attribute name of country is not among the enumerated set.

What did I do wrong?

Upvotes: 1

Views: 351

Answers (1)

Daniel Haley
Daniel Haley

Reputation: 52878

That's because of:

<!ATTLIST country name (PCDATA)

it thinks that PCDATA is a value in an enumeration. Try changing it to CDATA (without parentheses)...

<!ATTLIST country 
          name CDATA #REQUIRED 
          population CDATA #REQUIRED 
          area CDATA #REQUIRED>

Upvotes: 1

Related Questions