A Gentle Introduction to
Planet Node: ATTLIST with CDATA and ID
The XML document shown starts with the DTD - this tells us that there
must be a top level node planet which may contain any number
of country nodes. Each country must have three attributes
cc (internet country code), nm (name in English) and
pop (population in millions).
Following the DTD section we have the data itself - so far we have only
two countries - France and Ireland.
- Click on the Submit button to check that the document is valid.
- Add a new country
<country cc="br" nm="Brazil" bop="176.0"/>
Notice what happens if you use the wrong attribute name (bop instead of pop)?
- Find out what happens if two countries have the same cc.
- Experiment! Discover which of the following symbols may be used
at the start or in the middle of an ID attribute such as cc.
- A digit 3
- An underscore _
- A colon :
- A dollar $