    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.

##

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.

##

xt_SaxEngine()
  Constructor.

##

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

##

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.

##

xt_SaxEngine

     public xt_SaxEngine()

  Constructor.

##

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

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

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

setDriverName

     public void setDriverName(String InputSaxDriverName)

  Set the name of the SAX driver class.

  Parameters:
    InputSaxDriverName - The name of the SAX driver class

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

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.

startDocument

     public void startDocument()

  Display a message at the start of the document.

endDocument

     public void endDocument()

  Display a message at the end of the document.

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

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

characters

     public void characters(char InputChars[],
                            int start,
                            int length)

  Display a message when characters are found.

ignorableWhitespace

     public void ignorableWhitespace(char InputChars[],
                                     int start,
                                     int length)

  Display a message when ignorable whitespace is found.

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