Let's take a second look at more extending parsers for the SimpleMap demo program. This time we will use an xml parser. The new parser, MapHandler, now extends the HandlerBase object from the org.xml.sax package. To better integrate it into the demo, it also implements the ContentParser interface. Note that MapHandler depends on the SAX parser in Java 1.4. It can be easily changed to use other SAX parsers.
Once more... the rest of SimpleMap is trivial. In fact, because we have implemented the ContentParser interface for our parser, the only line that has changed is for the creation of the ContentParser object from NarcissusParser to MapHandler.