The goal of this laboratory assignment is to perform simple XML parsing on an XML document using a DOM (document object model) parser (tree based), and a SAX parser (event based). Use of the Xerces XML parser is recommended for this assignment, as a version of this parser has been made available in the class locker for this course. Xerces supports both DOM and SAX styles of parsing.
If you're performing this assignment on the CATS machines (such as unix.ic), you should first perform the following setup steps.
The following two problems use this XML file as the input. The XML document is an XML representation of an IETF protocol specification, being considered by the WebDAV working group. The description of the XML elements used in this document can be found in RFC 2629.
1. Using the DOM parsing approach, write a program to analyze the input file and output the following to standard output (console):
These can be found in the XML elements and attributes:
It should be possible to find and output this information in a single pass through the XML document parse tree.
2. Using the SAX parsing approach, write a program to analyze the input file and output the following statistics to standard output (console):
For each problem, submit your program, and the generated output.
Last modified: