The goal of this laboratory assignment is to perform simple XML parsing on an XML document using 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, but you are only expected to use the SAX parsing capability for this assignment.
If you're performing this assignment on the CATS machines (such as unix.ic), you should first perform the following setup steps.
The example SAX parsing program shown in lab can be found here. When run with this input file, it produces the following output file. The example is described in more detail at its source, on SAXproject.org.
You are provided with a sample xml document, which contains Yahoo sports news on Mar. 31, 2005. You are required to extract some interesting information from this XML document.
Your task is to write a short program in Java using a SAX parser that will analyze the XML input file and output the following to standard output (print to the console)
These can be found with the following XML elements and attributes:
An example output of this program can be found here. Your output format can be slightly different from this example, but the order of pieces of outputted information for each news should follow this output example, i.e. the info of highest rating and average rating for a piece of news should come after the reporter info and publishing date info for this news.
For the assignment please submit your program, the generated output, and a short readme file showing what you need to do on the command line to compile and run the program. Using a makefile is recommended but not required.
Last modified: