com.simonstl.midp.xml
Class HandlerTest

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

public class HandlerTest
extends TAMHandlerImpl

HandlerTest is a very basic extension of TAMHandlerImpl that reports events to System.out.

Author:
simonstl

Constructor Summary
HandlerTest()
          Creates a new instance of HandlerTest
 
Method Summary
 void characters(char[] buf, int offset, int length)
          The characters() method behaves like its SAX2 equivalent.
 void comment(char[] buf, int offset, 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 endElement(java.lang.String uri, java.lang.String localName, java.lang.String prefix)
          endElement behaves like SAX2, except that it reports the prefix rather than the QName.
 void fatalError(TAMException e)
          The fatalError() method behaves like its SAX2 equivalent except that it uses TAMExceptions instead of SAXExceptions.
static void main(java.lang.String[] args)
           
 void processingInstruction(java.lang.String target, java.lang.String data)
          The processingInstruction() method behaves like its SAX2 equivalent.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String prefix, TamAttributes attributes)
          startElement behaves like SAX2 except that it reports the prefix rather than the QName.
 void test()
           
 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 com.simonstl.midp.xml.TAMHandlerImpl
endCDATA, endDocument, error, skippedEntity, startCDATA, startDocument, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerTest

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

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String prefix,
                         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.
Overrides:
startElement in class TAMHandlerImpl

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String prefix)
                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.
Overrides:
endElement in class TAMHandlerImpl

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.
Overrides:
characters in class TAMHandlerImpl

comment

public void comment(char[] buf,
                    int offset,
                    int length)
             throws TAMException
Description copied from interface: TamHandler
The comment() method behaves like its SAX2 ext LexicalHandler equivalent.
Overrides:
comment in class TAMHandlerImpl

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.
Overrides:
doctype in class TAMHandlerImpl

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.)
Overrides:
XMLDecl in class TAMHandlerImpl

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Description copied from interface: TamHandler
The processingInstruction() method behaves like its SAX2 equivalent.
Overrides:
processingInstruction in class TAMHandlerImpl

fatalError

public void fatalError(TAMException e)
Description copied from interface: TamHandler
The fatalError() method behaves like its SAX2 equivalent except that it uses TAMExceptions instead of SAXExceptions.
Overrides:
fatalError in class TAMHandlerImpl

test

public void test()
          throws TAMException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception