Validating sax parser call first
For those reasons, developers who are writing a user-oriented application that displays an XML document and possibly modifies it will want to use the DOM mechanism described in Chapter 3, Document Object Model.
However, even if you plan to build DOM applications exclusively, there are several important reasons for familiarizing yourself with the SAX model: It is helpful to understand the SAX event model when you want to convert existing data to XML.
In real-life applications, you will want to use the SAX parser to process XML data and do something useful with it.
But for nonfatal errors and warnings, exceptions are never generated by the default error handler, and no messages are displayed.
SAX is an event-driven model (you provide the callback methods, and the parser invokes them as it reads the XML data), and that makes it harder to visualize.
Finally, you cannot "back up" to an earlier part of the document, or rearrange it, any more than you can back up a serial data stream or rearrange characters you have read from that stream.
The first order of business is to process the command-line arguments, which at this stage only serve to get the name of the file to process.
The following code in the when it encounters problems, and defines the command-line options which are required to tell the application the name of the XML file to be processed.