Zoo tutorials: [ SQL | Linux | XML ]

A Gentle Introduction to xml

Planet Node: A simple example
With answers

In this instructive example we show the syntax of a simple dtd and xml document. In this example the dtd is included at the start of the xml document.

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 contain two nodes

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>
      <name>Brazil</name>
      <bop>176.0</bop>
     </country>
    Notice what happens if you use the wrong attribute name (bop instead of pop)?
  3. Find out what happens if the name and pop are in the wrong order.
  4. Remove every country. Is the planet still valid?