com.simonstl.midp.xml
Class TAMHandlerImpl

java.lang.Object
  |
  +--com.simonstl.midp.xml.TAMHandlerImpl
All Implemented Interfaces:
TamHandler
Direct Known Subclasses:
HandlerTest

public class TAMHandlerImpl
extends java.lang.Object
implements TamHandler

A no-op set of handlers that can be used for easy and more complete handling of TAM events.

Author:
simonstl

Constructor Summary
TAMHandlerImpl()
          Creates a new instance of TAMHandlerImpl
 
Method Summary
 void characters(char[] buf, int offset, int length)
          The characters() method behaves like its SAX2 equivalent.
 void comment(char[] ch, int start, int length)
          The comment() method behaves like its SAX2 ext LexicalHandler equivalent.
 void doctype(char[] buf, int offset, int length)
          This event provides applications with the complete contents of the DOCTYPE declaration.
 void endCDATA()
          The endCDATA() method behaves like its SAX2 ext LexicalHandler equivalent.
 void endDocument()
          This event is called at the end of parsing, just like its SAX2 counterpart.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          endElement behaves like SAX2, except that it reports the prefix rather than the QName.
 void error(TAMException x)
          The error() method behaves like its SAX2 equivalent except that it uses TAMExceptions instead of SAXExceptions.
 void fatalError(TAMException x)
          The fatalError() method behaves like its SAX2 equivalent except that it uses TAMExceptions instead of SAXExceptions.
 void processingInstruction(java.lang.String target, java.lang.String data)
          The processingInstruction() method behaves like its SAX2 equivalent.
 void skippedEntity(java.lang.String name)
          Because TAM-based parsers aren't required to read the DTD, all entities other than the built-in entities (lt, gt, apos, and quot) will be reported as skipped entities.
 void startCDATA()
          The startCDATA() method behaves like its SAX2 ext LexicalHandler equivalent.
 void startDocument()
          This event is called at the beginning of parsing, just like its SAX2 counterpart.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, TamAttributes attributes)
          startElement behaves like SAX2 except that it reports the prefix rather than the QName.
 void warning(TAMException x)
          The warning() method behaves like its SAX2 equivalent except that it uses TAMExceptions instead of SAXExceptions.
 void XMLDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone)
          The XMLDecl method is new, and may be useful to applications who need to know if the encoding used by a given document is supported by their environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TAMHandlerImpl

public TAMHandlerImpl()
Creates a new instance of TAMHandlerImpl
Method Detail

characters

public void characters(char[] buf,
                       int offset,
                       int length)
                throws TAMException
Description copied from interface: TamHandler
The characters() method behaves like its SAX2 equivalent. Applications should be cautious in making sure that they collect all the character events that collectively make up a single "text node", as TAM-based parsers are likely to report lots of fragments because of buffering and entity handling.
Specified by:
characters in interface TamHandler

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws TAMException
Description copied from interface: TamHandler
The comment() method behaves like its SAX2 ext LexicalHandler equivalent.
Specified by:
comment in interface TamHandler

doctype

public void doctype(char[] buf,
                    int offset,
                    int length)
             throws TAMException
Description copied from interface: TamHandler
This event provides applications with the complete contents of the DOCTYPE declaration. As TAM-based parsers may not have the space to keep these declarations around, the application is given the option of such processing. Note that this approach is a fundamental change to the division of responsibilities that XML 1.0 establishes between applications and parsers. All DTD work is now the responsibility of the application, not the parser, including default values for attributes and entity processing.
Specified by:
doctype in interface TamHandler

endCDATA

public void endCDATA()
              throws TAMException
Description copied from interface: TamHandler
The endCDATA() method behaves like its SAX2 ext LexicalHandler equivalent.
Specified by:
endCDATA in interface TamHandler

endDocument

public void endDocument()
                 throws TAMException
Description copied from interface: TamHandler
This event is called at the end of parsing, just like its SAX2 counterpart. It's especially useful if you need to capture events after the root element has completed.
Specified by:
endDocument in interface TamHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws TAMException
Description copied from interface: TamHandler
endElement behaves like SAX2, except that it reports the prefix rather than the QName. There is no "namespaces on or off" setting - if an element or attribute lacks a namespace, it is reported as an empty string. Local names and prefixes are both always reported.
Specified by:
endElement in interface TamHandler

error

public void error(TAMException x)
           throws TAMException
Description copied from interface: TamHandler
The error() method behaves like its SAX2 equivalent except that it uses TAMExceptions instead of SAXExceptions.
Specified by:
error in interface TamHandler

fatalError

public void fatalError(TAMException x)
                throws TAMException
Description copied from interface: TamHandler
The fatalError() method behaves like its SAX2 equivalent except that it uses TAMExceptions instead of SAXExceptions.
Specified by:
fatalError in interface TamHandler

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws TAMException
Description copied from interface: TamHandler
The processingInstruction() method behaves like its SAX2 equivalent.
Specified by:
processingInstruction in interface TamHandler

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws TAMException
Description copied from interface: TamHandler
Because TAM-based parsers aren't required to read the DTD, all entities other than the built-in entities (lt, gt, apos, and quot) will be reported as skipped entities.
Specified by:
skippedEntity in interface TamHandler

startCDATA

public void startCDATA()
                throws TAMException
Description copied from interface: TamHandler
The startCDATA() method behaves like its SAX2 ext LexicalHandler equivalent.
Specified by:
startCDATA in interface TamHandler

startDocument

public void startDocument()
                   throws TAMException
Description copied from interface: TamHandler
This event is called at the beginning of parsing, just like its SAX2 counterpart.
Specified by:
startDocument in interface TamHandler

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         TamAttributes attributes)
                  throws TAMException
Description copied from interface: TamHandler
startElement behaves like SAX2 except that it reports the prefix rather than the QName. There is no "namespaces on or off" setting - if an element or attribute lacks a namespace, it is reported as an empty string. Local names and qNames are both always reported.
Specified by:
startElement in interface TamHandler

warning

public void warning(TAMException x)
             throws TAMException
Description copied from interface: TamHandler
The warning() method behaves like its SAX2 equivalent except that it uses TAMExceptions instead of SAXExceptions.
Specified by:
warning in interface TamHandler

XMLDecl

public void XMLDecl(java.lang.String version,
                    java.lang.String encoding,
                    java.lang.String standalone)
Description copied from interface: TamHandler
The XMLDecl method is new, and may be useful to applications who need to know if the encoding used by a given document is supported by their environment. (J2ME is much more limited in this regard than J2SE, despite using Unicode internally.)
Specified by:
XMLDecl in interface TamHandler