helma.xmlrpc.applet
Class HandlerBase

java.lang.Object
  |
  +--helma.xmlrpc.applet.HandlerBase
All Implemented Interfaces:
XmlHandler

public class HandlerBase
extends java.lang.Object
implements XmlHandler

Convenience base class for AElfred handlers.

This base class implements the XmlHandler interface with (mostly empty) default handlers. You are not required to use this, but if you need to handle only a few events, you might find it convenient to extend this class rather than implementing the entire interface. This example overrides only the charData method, using the defaults for the others:

 import com.microstar.xml.HandlerBase;

 public class MyHandler extends HandlerBase {
   public void charData (char ch[], int start, int length)
   {
     System.out.println("Data: " + new String (ch, start, length));
   }
 }
 

This class is optional, but if you use it, you must also include the XmlException class.

Do not extend this if you are using SAX; extend org.xml.sax.HandlerBase instead.

See Also:
XmlHandler, XmlException, HandlerBase

Constructor Summary
HandlerBase()
           
 
Method Summary
 void attribute(java.lang.String aname, java.lang.String value, boolean isSpecified)
          Handle an attribute assignment.
 void charData(char[] ch, int start, int length)
          Handle character data.
 void doctypeDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Handle a document type declaration.
 void endDocument()
          Handle the end of the document.
 void endElement(java.lang.String elname)
          Handle the end of an element.
 void endExternalEntity(java.lang.String systemId)
          Handle the end of an external entity.
 void error(java.lang.String message, java.lang.String systemId, int line, int column)
          Throw an exception for a fatal error.
 void ignorableWhitespace(char[] ch, int start, int length)
          Handle ignorable whitespace.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Handle a processing instruction.
 java.lang.Object resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolve an external entity.
 void startDocument()
          Handle the start of the document.
 void startElement(java.lang.String elname)
          Handle the start of an element.
 void startExternalEntity(java.lang.String systemId)
          Handle the start of an external entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerBase

public HandlerBase()
Method Detail

startDocument

public void startDocument()
                   throws java.lang.Exception
Handle the start of the document.

The default implementation does nothing.

Specified by:
startDocument in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#startDocument

endDocument

public void endDocument()
                 throws java.lang.Exception
Handle the end of the document.

The default implementation does nothing.

Specified by:
endDocument in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#endDocument

resolveEntity

public java.lang.Object resolveEntity(java.lang.String publicId,
                                      java.lang.String systemId)
                               throws java.lang.Exception
Resolve an external entity.

The default implementation simply returns the supplied system identifier.

Specified by:
resolveEntity in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#resolveEntity

startExternalEntity

public void startExternalEntity(java.lang.String systemId)
                         throws java.lang.Exception
Handle the start of an external entity.

The default implementation does nothing.

Specified by:
startExternalEntity in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#startExternalEntity

endExternalEntity

public void endExternalEntity(java.lang.String systemId)
                       throws java.lang.Exception
Handle the end of an external entity.

The default implementation does nothing.

Specified by:
endExternalEntity in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#endExternalEntity

doctypeDecl

public void doctypeDecl(java.lang.String name,
                        java.lang.String publicId,
                        java.lang.String systemId)
                 throws java.lang.Exception
Handle a document type declaration.

The default implementation does nothing.

Specified by:
doctypeDecl in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#doctypeDecl

attribute

public void attribute(java.lang.String aname,
                      java.lang.String value,
                      boolean isSpecified)
               throws java.lang.Exception
Handle an attribute assignment.

The default implementation does nothing.

Specified by:
attribute in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#attribute

startElement

public void startElement(java.lang.String elname)
                  throws java.lang.Exception
Handle the start of an element.

The default implementation does nothing.

Specified by:
startElement in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#startElement

endElement

public void endElement(java.lang.String elname)
                throws java.lang.Exception
Handle the end of an element.

The default implementation does nothing.

Specified by:
endElement in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#endElement

charData

public void charData(char[] ch,
                     int start,
                     int length)
              throws java.lang.Exception
Handle character data.

The default implementation does nothing.

Specified by:
charData in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#charData

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws java.lang.Exception
Handle ignorable whitespace.

The default implementation does nothing.

Specified by:
ignorableWhitespace in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#ignorableWhitespace

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws java.lang.Exception
Handle a processing instruction.

The default implementation does nothing.

Specified by:
processingInstruction in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#processingInstruction

error

public void error(java.lang.String message,
                  java.lang.String systemId,
                  int line,
                  int column)
           throws XmlException,
                  java.lang.Exception
Throw an exception for a fatal error.

The default implementation throws XmlException.

Specified by:
error in interface XmlHandler
Throws:
com.microstar.xml.XmlException - A specific parsing error.
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#error