com.microstar.xml
Class SAXDriver

com.microstar.xml.SAXDriver

public class SAXDriver
implements XmlHandler

A SAX driver for Microstar's Ælfred XML parser.

This driver acts as a front-end for Ælfred, and translates Ælfred's events into SAX events. It implements the SAX parser interface, and you can use it without directly calling Ælfred at all:

 org.xml.sax.Parser parser = new com.microstar.xml.SAXDriver();
 

When you are using SAX, you do not need to use the XmlParser or XmlHandler classes at all: this class is your entry point.

This driver is based on the 1.0gamma version of SAX, available from http://www.megginson.com/SAX/

Version:
1.1
Author:
Copyright (c) 1998 by Microstar Software Ltd., written by David Megginson <dmeggins@microstar.com>
See Also:
org.xml.sax.Parser, XmlParser

Constructor Summary
SAXDriver()
           
 
Method Summary
 void attribute(java.lang.String aname, java.lang.String value, boolean isSpecified)
          Implement com.microstar.xml.XmlHandler#attribute.
 void charData(char[] ch, int start, int length)
          Implement com.microstar.xml.XmlHandler#charData.
 void doctypeDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Implement com.microstar.xml.XmlHandler#doctypeDecl.
 void endDocument()
          Implement com.microstar.xml.XmlHandler#endDocument.
 void endElement(java.lang.String elname)
          Implement com.microstar.xml.XmlHandler#endElement.
 void endExternalEntity(java.lang.String systemId)
          Implement com.microstar.xml.XmlHandler#endExternalEntity.
 void error(java.lang.String message, java.lang.String url, int line, int column)
          Implement com.microstar.xml.XmlHandler#error.
 int getColumnNumber()
           
 int getLength()
           
 int getLineNumber()
           
 java.lang.String getName(int i)
           
 java.lang.String getPublicId()
           
 java.lang.String getSystemId()
           
 java.lang.String getType(int i)
           
 java.lang.String getType(java.lang.String name)
           
 java.lang.String getValue(int i)
           
 java.lang.String getValue(java.lang.String name)
           
 void ignorableWhitespace(char[] ch, int start, int length)
          Implement com.microstar.xml.XmlHandler#ignorableWhitespace.
 void parse(org.xml.sax.InputSource source)
          Parse a document.
 void parse(java.lang.String systemId)
          Parse an XML document from a system identifier (URI).
 void processingInstruction(java.lang.String target, java.lang.String data)
          Implement com.microstar.xml.XmlHandler#processingInstruction.
 java.lang.Object resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Implement com.microstar.xml.XmlHandler.resolveSystemId
 void setDocumentHandler(org.xml.sax.DocumentHandler handler)
          Set the document handler for this parser.
 void setDTDHandler(org.xml.sax.DTDHandler handler)
          Set the DTD handler for this parser.
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
          Set the entity resolver for this parser.
 void setErrorHandler(org.xml.sax.ErrorHandler handler)
          Set the error handler for this parser.
 void setLocale(java.util.Locale locale)
          Set the locale.
 void startDocument()
          Implement com.microstar.xml.XmlHandler#startDocument.
 void startElement(java.lang.String elname)
          Implement com.microstar.xml.XmlHandler#startElement.
 void startExternalEntity(java.lang.String systemId)
          Implement com.microstar.xml.XmlHandler#startExternalEntity.
 

Constructor Detail

SAXDriver

public SAXDriver()
Method Detail

setLocale

public void setLocale(java.util.Locale locale)
               throws org.xml.sax.SAXException
Set the locale.
See Also:
org.xml.sax.Parser#setLocale

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
Set the entity resolver for this parser.
Parameters:
handler - The object to receive entity events.
See Also:
org.xml.sax.Parser#setEntityResolver

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler handler)
Set the DTD handler for this parser.
Parameters:
handler - The object to receive DTD events.
See Also:
org.xml.sax.Parser#setDTDHandler

setDocumentHandler

public void setDocumentHandler(org.xml.sax.DocumentHandler handler)
Set the document handler for this parser.
Parameters:
handler - The object to receive document events.
See Also:
org.xml.sax.Parser#setDocumentHandler

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler handler)
Set the error handler for this parser.
Parameters:
handler - The object to receive error events.
See Also:
org.xml.sax.Parser#setErrorHandler

parse

public void parse(org.xml.sax.InputSource source)
           throws org.xml.sax.SAXException
Parse a document.

If you want anything useful to happen, you should set at least one type of handler.

Parameters:
source - The XML input source.
Throws:
SAXException - The handlers may throw any exception.
See Also:
org.xml.sax.Parser#parse(InputSource), setEntityResolver(org.xml.sax.EntityResolver), setDTDHandler(org.xml.sax.DTDHandler), setDocumentHandler(org.xml.sax.DocumentHandler), setErrorHandler(org.xml.sax.ErrorHandler)

parse

public void parse(java.lang.String systemId)
           throws org.xml.sax.SAXException
Parse an XML document from a system identifier (URI).
See Also:
org.xml.sax.Parser#parse(String)

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#startDocument.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
startDocument in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.startDocument()

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#endDocument.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
endDocument in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.endDocument()

resolveEntity

public java.lang.Object resolveEntity(java.lang.String publicId,
                                      java.lang.String systemId)
                               throws org.xml.sax.SAXException,
                                      java.io.IOException
Implement com.microstar.xml.XmlHandler.resolveSystemId

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
resolveEntity in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.resolveEntity(java.lang.String, java.lang.String)

startExternalEntity

public void startExternalEntity(java.lang.String systemId)
                         throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#startExternalEntity.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
startExternalEntity in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.startExternalEntity(java.lang.String)

endExternalEntity

public void endExternalEntity(java.lang.String systemId)
                       throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#endExternalEntity.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
endExternalEntity in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.endExternalEntity(java.lang.String)

doctypeDecl

public void doctypeDecl(java.lang.String name,
                        java.lang.String publicId,
                        java.lang.String systemId)
                 throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#doctypeDecl.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
doctypeDecl in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.doctypeDecl(java.lang.String, java.lang.String, java.lang.String)

attribute

public void attribute(java.lang.String aname,
                      java.lang.String value,
                      boolean isSpecified)
               throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#attribute.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
attribute in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.attribute(java.lang.String, java.lang.String, boolean)

startElement

public void startElement(java.lang.String elname)
                  throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#startElement.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
startElement in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.startElement(java.lang.String)

endElement

public void endElement(java.lang.String elname)
                throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#endElement.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
endElement in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.endElement(java.lang.String)

charData

public void charData(char[] ch,
                     int start,
                     int length)
              throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#charData.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
charData in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.charData(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#ignorableWhitespace.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
ignorableWhitespace in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#processingInstruction.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
processingInstruction in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.processingInstruction(java.lang.String, java.lang.String)

error

public void error(java.lang.String message,
                  java.lang.String url,
                  int line,
                  int column)
           throws org.xml.sax.SAXException
Implement com.microstar.xml.XmlHandler#error.

Translate to the SAX interface.

Users should never invoke this method directly.

Specified by:
error in interface XmlHandler
Throws:
SAXException - May throw any exception.
See Also:
XmlHandler.error(java.lang.String, java.lang.String, int, int)

getLength

public int getLength()

getName

public java.lang.String getName(int i)

getType

public java.lang.String getType(int i)

getValue

public java.lang.String getValue(int i)

getType

public java.lang.String getType(java.lang.String name)

getValue

public java.lang.String getValue(java.lang.String name)

getPublicId

public java.lang.String getPublicId()

getSystemId

public java.lang.String getSystemId()

getLineNumber

public int getLineNumber()

getColumnNumber

public int getColumnNumber()