Zoo tutorials: [ SQL | Linux | XML ]

A Gentle Introduction to xml

Planet Node: ATTLIST with CDATA and ID

Simple restrictions

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.

  1. Click on the Submit button to check that the document is valid.
  2. 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)?
  3. Find out what happens if two countries have the same cc.
  4. Experiment! Discover which of the following symbols may be used at the start or in the middle of an ID attribute such as cc.
    1. A digit 3
    2. An underscore _
    3. A colon :
    4. A dollar $