Programming XML in Java - Homework 2

Instructor: John Punin
CSCI 4968 Spring 2002
Due: February 25th 11:59:59 PM

Objective

The objective of this homework is to help you become familiar with the SAX and DOM interfaces for XML parsers.

Description

The structure of a web site can be saved in a graph structure. The nodes of the graph represent the web pages and the edges of the graph represent the hyperlinks between the pages. XGMML is an XML application language to save graph structures. This is a simple example of an XGMML file that represents a graph with two nodes (web pages) and one edge (hyperlink) :
<?xml version="1.0"?>
<graph>
  <node id="1" label="http://www.example.org/" weight="2345">
    <att name="title" value="Example Main Page"/>
    <att name="mime" value="text/html"/>
    <att name="size" value="2345"/>
    <att name="date" value="Wed Jun  9 23:01:06 2000"/>
    <att name="code" value="200"/>
  </node>
  <node id="2" label="http://www.example.org/software/" weight="1234">
    <att name="title" value="Software Examples"/>
    <att name="mime" value="text/html"/>
    <att name="size" value="1234"/>
    <att name="date" value="Wed Sep  19 13:11:23 2000"/>
    <att name="code" value="200"/>
  </node>
  <edge label="Software" source="1" target="2"/>
</graph>
The only elements that you need to know for this homework are: graph, node, edge and att. Problem: Given two XGMML files, generate an HTML file that contains a list of node labels of nodes that are in the first XGMML file and not in the second XGMML file.

Part A

Write a SAX application that solves the given problem. For this problem you are required to use Xerces XML Parser.

Part B

Write a DOM application that solves the given problem. For this problem you are required to use Xerces XML Parser.

Additional Information

I will provide with two XGMML file called xmljs.gr and xmljf.gr. You should write two java files: SAXdiff.java and DOMdiff.java. Please write comments in your java code.

An example how to run your java application SAXdiff:

> java SAXdiff xmljs.gr xmljf.gr list.html


Where xmljs.gr and xmljf.gr are the given XGMML files and list.html the name of the HTML file output.

If you are interested in reading more about XGMML: http://www.cs.rpi.edu/~puninj/XGMML/


Submission procedure:

Send one email message to konkew@rpi.edu, with the subject line reading "XMLJ: HW # 2 submission". You can write a little message if you want and then should include the files AS ATTACHMENTS. If you have 2 files, then you should have 2 attachments in the email message. Just as long as each attachment contains only one file.
to Programming XML in Java Home Page