| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--de.zeigermann.xpa.tokenParser.Parser2XMLTokenStreamAdapter
This abstract class provides base functionality to adapt XML parsers to a
 token stream needed by ANTLR genrated (token) parsers.
 
 While the task of actually parsing something is delegated to its 
 subclasses this class is capable of creating XML tokens from XML parsing
 data. Subclasses should call tellWhiteSpace(java.lang.String), tellPCDATA(java.lang.String),
 tellStartElement(java.lang.String, org.xml.sax.helpers.AttributesImpl), and  tellEndDocument() to deliver this
 XML information.
| Field Summary | |
protected  XMLTokenTypeManager | 
tokenManager
 | 
| Constructor Summary | |
Parser2XMLTokenStreamAdapter(XMLTokenTypeManager tokenManager)
Creates a new adapter using tokenManager. | 
|
| Method Summary | |
protected abstract  void | 
applyLocatorInfo(Token token)
Depending on implementation set line and column number of token if available.  | 
 boolean | 
getIgnoreAllWhiteSpace()
Gets property described in setIgnoreAllWhiteSpace(boolean). | 
 boolean | 
getTreatValidWhiteSpaceAsIgnorable()
Gets property described in setTreatValidWhiteSpaceAsIgnorable(boolean). | 
abstract  Token | 
nextToken()
Gets the next token.  | 
 void | 
setIgnoreAllWhiteSpace(boolean ignoreAllWhiteSpace)
Sets if all whitespace is ignored.  | 
protected abstract  void | 
setNextToken(Token token)
Sets next token generated by adapter methods.  | 
 void | 
setTreatValidWhiteSpaceAsIgnorable(boolean treatValidWhiteSpaceAsIgnorable)
Sets if valid whitespace is treated like ignoreable whitespace.  | 
protected  void | 
tellEndDocument()
Tells this adapter that the XML document has now ended no no more call back will occur.  | 
protected  void | 
tellEndElement(String tag)
Tells this adapter to make an XMLEndToken out of an end tag. | 
protected  void | 
tellPCDATA(String pcdata)
Tells this adapter to make an XMLToken out of 
 parseable character 
 data.  | 
protected  void | 
tellStartElement(String tag,
                 AttributesImpl attributes)
Tells this adapter to make an XMLStartToken out of a start tag. | 
protected  void | 
tellWhiteSpace(String cdata)
Tells this adapter to make an XMLToken out of whitespace. 
  | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
protected XMLTokenTypeManager tokenManager
| Constructor Detail | 
public Parser2XMLTokenStreamAdapter(XMLTokenTypeManager tokenManager)
tokenManager.
tokenManager - the token manager to determine token types for token
 generation| Method Detail | 
public abstract Token nextToken()
                         throws TokenStreamException
nextToken in interface TokenStreamTokenStreamExceptionsetNextToken(antlr.Token)protected abstract void applyLocatorInfo(Token token)
protected abstract void setNextToken(Token token)
nextToken() in exatcly the same order as set here.
 This contract is important if a queueing mechanism is used.
nextToken()public void setIgnoreAllWhiteSpace(boolean ignoreAllWhiteSpace)
false
tellWhiteSpace(java.lang.String)public boolean getIgnoreAllWhiteSpace()
setIgnoreAllWhiteSpace(boolean).
public void setTreatValidWhiteSpaceAsIgnorable(boolean treatValidWhiteSpaceAsIgnorable)
true
tellPCDATA(java.lang.String)public boolean getTreatValidWhiteSpaceAsIgnorable()
setTreatValidWhiteSpaceAsIgnorable(boolean).
protected void tellWhiteSpace(String cdata)
XMLToken out of whitespace. 
 In fact this 
 adapter will only make a token out of it if not forbidden by 
 setIgnoreAllWhiteSpace(boolean). Also, if the underlying token manager
 has no type for whitespace, no token will be created.
cdata - the whitespace this adapter is notified ofsetIgnoreAllWhiteSpace(boolean)protected void tellPCDATA(String pcdata)
XMLToken out of 
 parseable character 
 data. If valid whitespace is treated like ignoreable whitespace 
 as defined by setTreatValidWhiteSpaceAsIgnorable(boolean) whitespace
 reported by this method will be forwarded to 
 tellWhiteSpace(java.lang.String).
pcdata - the parseable character data
 this adapter is notified ofsetTreatValidWhiteSpaceAsIgnorable(boolean)
protected void tellStartElement(String tag,
                                AttributesImpl attributes)
XMLStartToken out of a start tag.
tag - name of this start tagattributes - attributes associated to this start tagprotected void tellEndElement(String tag)
XMLEndToken out of an end tag.
tag - name of this end tagprotected void tellEndDocument()
XMLToken for EOF as ANTLR
 generated (token) parsers expect it.
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||