com.simonstl.midp.xml
Class TAMParserImpl

java.lang.Object
  |
  +--com.simonstl.midp.xml.TAMParserImpl
All Implemented Interfaces:
TamParser

public class TAMParserImpl
extends java.lang.Object
implements TamParser

A simple implementation of an XML parser using the TAM interface. Note that this parser leaves all DOCTYPE processing to the application, and that it can apply but not recognize namespace declarations.

Author:
simonstl

Constructor Summary
TAMParserImpl()
          Creates a new instance of TAMParserImpl
 
Method Summary
protected  void error(java.lang.String s)
           
protected  void fatalError(java.lang.String s)
           
 boolean getFeature(java.lang.String name)
          Works like the SAX2 getFeature() method.
 TamHandler getHandler()
          Lets you retrieve the handler assigned to a particular parser.
protected  int hexRefToDec()
           
protected  boolean isSpace(char c)
           
protected  java.lang.String normName(java.lang.String name)
           
protected  java.lang.String normPrefix(java.lang.String name)
           
protected  java.lang.String normQName(java.lang.String qName)
           
 void parse(java.io.InputStream in)
          Works the same as the SAX2 parse(InputStream in) method.
protected  void reportCharacters()
           
protected  void reportComment()
           
protected  void reportDOCTYPE()
           
protected  void reportElementEnd()
           
protected  void reportElementStart()
           
protected  void reportPI()
           
protected  void reportSkippedEntity(java.lang.String entName)
           
protected  void reportState(java.lang.String label, int state, int num, char currentChar, boolean buffer)
           
 void reset()
          Clears entity and namespace state from prior operations.
 void setEntity(java.lang.String name, java.lang.String value)
          Allows applications to set additional entities for the parser to resolve beyond the built-in set.
 void setFeature(java.lang.String name, boolean value)
          Works like the SAX2 setFeature() method.
 void setHandler(TamHandler _handler)
          Lets you set the handler assigned to a particular parser.
 void setMaxBuf(int _size)
           
 void setNamespace(java.lang.String prefix, java.lang.String nsURI)
          Sets a namespace which will be used in processing.
protected  void warning(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TAMParserImpl

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

setMaxBuf

public void setMaxBuf(int _size)

getHandler

public TamHandler getHandler()
Description copied from interface: TamParser
Lets you retrieve the handler assigned to a particular parser.
Specified by:
getHandler in interface TamParser

setHandler

public void setHandler(TamHandler _handler)
Description copied from interface: TamParser
Lets you set the handler assigned to a particular parser.
Specified by:
setHandler in interface TamParser

parse

public void parse(java.io.InputStream in)
           throws TAMException
Description copied from interface: TamParser
Works the same as the SAX2 parse(InputStream in) method. Because J2ME devices vary widely, there is no support in TAM for parse(String systemID)
Specified by:
parse in interface TamParser

isSpace

protected boolean isSpace(char c)

hexRefToDec

protected int hexRefToDec()

fatalError

protected void fatalError(java.lang.String s)
                   throws TAMException

error

protected void error(java.lang.String s)
              throws TAMException

warning

protected void warning(java.lang.String s)
                throws TAMException

reportElementStart

protected void reportElementStart()
                           throws TAMException

reportCharacters

protected void reportCharacters()
                         throws TAMException

reportElementEnd

protected void reportElementEnd()
                         throws TAMException

reportPI

protected void reportPI()
                 throws TAMException

reportSkippedEntity

protected void reportSkippedEntity(java.lang.String entName)
                            throws TAMException

reportComment

protected void reportComment()
                      throws TAMException

reportDOCTYPE

protected void reportDOCTYPE()
                      throws TAMException

reportState

protected void reportState(java.lang.String label,
                           int state,
                           int num,
                           char currentChar,
                           boolean buffer)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
Description copied from interface: TamParser
Works like the SAX2 setFeature() method. TAM parsers are not required to support any particular features. setFeature() should generally be used before parsing. SAX2 properties are not supported.
Specified by:
setFeature in interface TamParser

getFeature

public boolean getFeature(java.lang.String name)
Description copied from interface: TamParser
Works like the SAX2 getFeature() method. TAM parsers are not required to support any particular features. getFeature() may be used at any time. SAX2 properties are not supported.
Specified by:
getFeature in interface TamParser

reset

public void reset()
Description copied from interface: TamParser
Clears entity and namespace state from prior operations.
Specified by:
reset in interface TamParser

setEntity

public void setEntity(java.lang.String name,
                      java.lang.String value)
               throws TAMException
Description copied from interface: TamParser
Allows applications to set additional entities for the parser to resolve beyond the built-in set. You cannot override the built-in entities. To "undeclare" an entity, set its value to null.
Specified by:
setEntity in interface TamParser

normQName

protected java.lang.String normQName(java.lang.String qName)

normName

protected java.lang.String normName(java.lang.String name)

normPrefix

protected java.lang.String normPrefix(java.lang.String name)

setNamespace

public void setNamespace(java.lang.String prefix,
                         java.lang.String nsURI)
                  throws TAMException
Description copied from interface: TamParser
Sets a namespace which will be used in processing. This takes effect as if it had been declared in the current level of document processing. Most typically, applications should set this before the root element is processed and avoid more complex efforts to play with namespaces in particular scopes. Once an element has been reported, it's not like you can go back and replay the reporting event.
Specified by:
setNamespace in interface TamParser