The SAX validator application uses the following SAX interfaces.
ISAXXMLReader interface. The SAX reader parses the XML and throws events to the handlers that you set for the reader. This application creates an instance of SAXXMLReader, enables SAX validation by setting the schema-validation feature, and sets the schema and schema-declaration-handler properties on the reader to fully enable support for SAX-based validation.XMLSchemaCache object and add the schema file (in this example, books.xsd) to it as a member. The XMLSchemaCache object is then assigned to the SAX reader to be used to validate the sample XML file (books.xml).MyValidator class implements this interface to receive content events that are thrown by the SAX reader. For this application, the content handler uses only a single event, the endDocument method, to acknowledge a successful validation of the file.MyValidator class implements this interface to receive errors that are thrown by the SAX reader.MyValidator class implements this interface and uses its lineNumber and columnNumber properties to return the position within the XML file as part of error reporting if a validation error occurs.This application consists of the following two main parts.
The form also has two command buttons: Validate and Exit. Pressing Validate starts application processing. Pressing Exit unloads the application form, effectively exiting the application.
IVBSAXContentHandler, IVBSAXErrorHandler, and IVBSAXLocator interfaces. When SAX parsing begins, the SAX reader throws a series of events that are received by an instance of this class. Validate Documents Using SAX | Overview of the SAX Validator Application | Application Form (SAX Validator) | Sample XSD Schema File (SAX Validator) | MyValidator Class (SAX Validator) | Run the Application (SAX Validator) | How the SAX Validator Application Works