Assignment 1: Processing XML with Java
Purpose
The purpose of this assignment is to practice using the Java library tools for handling XML.
Requirements
- Write a program that uses the SAX Parser to transform domain.xml to a readable HTML format such as domain.html. The HTML file that you generate does not need to be exactly the same as domain.html, but it needs to be a well-formed HTML file and human-readable in a common web browser. Name your main class file TransformerSAX.java. Your code should compile with command-line javac TransformerSAX.java
and run with command-line java TransformerSAX domain.xml and produce a domain.hml in the same directory.
- Write a program that uses the DOM Parser to read in domain.xml, reverse the order of the test elements in the DOM tree, and write it out as a XML file. This means that in the newly created XML file, the Culturing test will become the last test and the Water Chemistry will be the first test. Name your main class file ReverseDOM.java. Your code should compile with command-line javac ReverseDOM.java
and run with command-line java ReverseDOM domain.xml and produce a reverse.xml in the same directory.
Your programs will be tested with a different domain.xml than the one shown here. For example, the testing domain.xml will have more test elements in it.
Due date
This program must be received by 11:59pm EDT on 3/23.
Submitting
Submit your program by creating a zip file with your last name as the file name containing all the Java code files
related to your project, and email it to lqiu@oswego.edu with "CS535 Assignment 1 - your name" as the subject.
When I extract your zip file, your file should create a directory with your last name and all the code should be in that directory.
Do not send your source code directly as attachment to your email because some email program may add line-ending characters to your code which makes it fail to compile on my machine.
Grading rubrics