Zoo tutorials: [ SQL | Java | Linux | XML ]

A Gentle Introduction to xml

Casablanca
With answers

Question 1: Director

The input for this program is the file casablanca.xml

We are initially interested in the element:

<director>Michael Curtiz</director>

  1. Observe that the program prints the director of the movie.
  2. Change the program so that it outputs the title of the movie followed by the year in brackets. Casablanca (1944) Note that this data is held in a node:
    <title year="1942">Casablanca</title>
  3. Change the program so that is prints the name of the actor playing "Victor Laszlo".
  4. The previous example was fixed! The casablance.xml file has no redundant white space in it. The file casablanca2.xml does have redundant white space (as is common in XML documents). Change class S so that loads casablanca2.xml Does it still work?

Content Handler



Java SAX