All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class xt.xt_SaxEngine

java.lang.Object
   |
   +----xm.xm_XmlEngine
           |
           +----xt.xt_SaxEngine

public class xt_SaxEngine
extends xm_XmlEngine
implements EntityResolver, DocumentHandler
Engine for processing an XML source. Given the name of an XML file, initiate the parsing of it, and return a tree of xg_Node-derived classes representing it. The root xg_Node will currently always be an xg_Document, but xg_Node is used so that in future we may be able to parse partial documents.


Variable Index

 o DriverAttName
The name of the attribute in the attribute list whose value is the name of the SAX driver class, which in turn decides which parser to use.

Constructor Index

 o xt_SaxEngine()
Constructor.

Method Index

 o characters(char[], int, int)
Display a message when characters are found.
 o createParser(String)
Given a SAX driver class name, dynamically create a parser.
 o endDocument()
Display a message at the end of the document.
 o endElement(String)
The end of the current element has been parsed.
 o ignorableWhitespace(char[], int, int)
Display a message when ignorable whitespace is found.
 o parseSource(Reader, xg_Document)
Parse the source supplied by the InputSourceReader.
 o processingInstruction(String, String)
Print a message when a processing instruction is found.
 o resolveEntity(String, String)
Display a message when resolving an entity.
 o setDocumentLocator(Locator)
Receive an object for locating the origin of SAX document events.
 o setDriverName(String)
Set the name of the SAX driver class.
 o setParseListener(xm_ParseListener)
Set the parse listener which is to be informed of parse events.
 o startDocument()
Display a message at the start of the document.
 o startElement(String, AttributeList)
A new element has been parsed.

Variables

 o DriverAttName
 public static final String DriverAttName
The name of the attribute in the attribute list whose value is the name of the SAX driver class, which in turn decides which parser to use.

Constructors

 o xt_SaxEngine
 public xt_SaxEngine()
Constructor.

Methods

 o parseSource
 public xg_Node parseSource(Reader InputSourceReader,
                            xg_Document OutputDocument) throws xm_ParseException, IOException
Parse the source supplied by the InputSourceReader.

Parameters:
InputSourceReader - The reader from which to read the XML source
OutputDocument - Document into which to place the parse results
Returns:
The xg_Node representing the parse results
Throws: xm_ParseException
The XML source contains an error
Throws: IOException
An error occurred reading from InputSourceReader
Overrides:
parseSource in class xm_XmlEngine
 o createParser
 public static Parser createParser(String InputDriverClassName) throws xm_ParseException
Given a SAX driver class name, dynamically create a parser. The driver class must implement the SAX Parser interface.

Parameters:
InputDriverClassName - The name of the class
Throws: xm_ParseException
Error creating SAX parser
 o setParseListener
 public void setParseListener(xm_ParseListener InputParseListener)
Set the parse listener which is to be informed of parse events. The main purpose of this is to be able to show progress to the user; since SAX doesn't provide any information which allows us to do this, this implementation does nothing.

Parameters:
InputParseListener - Listener to be informed of certain parse events
Overrides:
setParseListener in class xm_XmlEngine
 o setDriverName
 public void setDriverName(String InputSaxDriverName)
Set the name of the SAX driver class.

Parameters:
InputSaxDriverName - The name of the SAX driver class
 o resolveEntity
 public InputSource resolveEntity(String publicID,
                                  String systemID)
Display a message when resolving an entity.

Parameters:
publicId - The public identifier of the external entity being referenced, or null if none was supplied
systemId - The system identifier of the external entity being referenced
Returns:
An InputSource object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier
 o setDocumentLocator
 public void setDocumentLocator(Locator InputLocator)
Receive an object for locating the origin of SAX document events.

Parameters:
InputLocator - An object that can return the location of any SAX document event.
 o startDocument
 public void startDocument()
Display a message at the start of the document.

 o endDocument
 public void endDocument()
Display a message at the end of the document.

 o startElement
 public void startElement(String InputElementName,
                          AttributeList InputAttList) throws SAXException
A new element has been parsed. Create an element object of a suitable type, give it its attributes and then add it to its parent.

Parameters:
InputElementName - The name of the new element
InputAttList - The new element's attributes
Throws: SAXException
Any SAX exception, possibly wrapping another exception
 o endElement
 public void endElement(String InputElementName) throws SAXException
The end of the current element has been parsed.

Parameters:
InputElementName - The name of the element just completed
Throws: SAXException
Error verifying this element
 o characters
 public void characters(char InputChars[],
                        int start,
                        int length)
Display a message when characters are found.

 o ignorableWhitespace
 public void ignorableWhitespace(char InputChars[],
                                 int start,
                                 int length)
Display a message when ignorable whitespace is found.

 o processingInstruction
 public void processingInstruction(String target,
                                   String data)
Print a message when a processing instruction is found.


All Packages  Class Hierarchy  This Package  Previous  Next  Index