He could immediately assign a grade to a student once the SAX parser reads the grade of this student.

In the above analysis, we assumed that the instructor created no data structure of his own.

I would like to configure it so that it doesn't validate the namespace or schema location information indicated in the incoming XML, but still attempts to validate the rest of the XML. I want to ignore this version number and go ahead and validate the remainder of the XML.

This is the class I'm using:: I maybe be able to adapt it to do the same thing. At the moment, my validation fails immediately because the xmlns version number in the incoming XML doesn't match the one I'm using.

If, however, the instructor adopts such a grading policy that the students who got 90 points or more, are assigned A's and the others are assigned B's, then probably he'd better use a SAX parser.

The reason is, to assign each student a final grade, he do not need to wait for the entire document to be processed.

But from the functionality point of view, it provides less functions which mean that the users themselves have to take care of more, such as creating their own data structures. I think the answer really depends on the characteristics of your application. ): Assume that an instructor has an XML document containing all the personal information of the students as well as the points his students made in his class, and he is now assigning final grades for the students using an application.

What he wants to produce, is a list with the SSN and the grades.

A tree-based API is centered around a tree structure and therefore provides interfaces on components of a tree (which is a DOM document) such as Document interface, Node interface, Node List interface, Element interface, Attr interface and so on.

By contrast, however, an event-based API provides interfaces on handlers.

Once some patterns (such as the start tag or end tag) are met, it thinks of the occurrences of these patterns as events and invokes some certain methods overriden by the client.

import *; import org.w3*; import org.apache.xerces.parsers. DOMParser; public class shapes_DOM { static int number Of Circles = 0; // total number of circles seen static int x[] = new int[1000]; // X-coordinates of the centers static int y[] = new int[1000]; // Y-coordinates of the centers static int r[] = new int[1000]; // radius of the circle static String color[] = new String[1000]; // colors of the circles public static void main(String[] args) { try{ // create a DOMParser DOMParser parser=new DOMParser(); parser.parse(args[0]); // get the DOM Document object Document doc=Document(); // get all the circle nodes Node List nodelist = Elements By Tag Name("circle"); number Of Circles = Length(); // retrieve all info about the circles for(int i=0; i import *; import sax.*; import sax.helpers.

In this case, a DOM parser should be a better choice no matter what grading policy he is adopting.