| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--de.zeigermann.xpa.treeParser.Parser2XMLASTAdapter
This abstract class is the superclass of all parser classes that 
 generate XMLASTs that are useable by XPA. 
 
 While the task of actually parsing something is delegated to its 
 subclasses this class is capable of creating a correctly structured
 and correctly typed XMLAST. Subclasses call 
 tellStartDocument(), 
 tellPCDATA(java.lang.String), tellStartElement(java.lang.String, org.xml.sax.Attributes) and tellEndElement(java.lang.String)
 to tell this class what XMLAST to construct.
 
| Field Summary | |
protected  XMLTokenTypeManager | 
tokenManager
 | 
protected  XMLAST | 
tree
Tree construction pointer  | 
protected  Stack | 
treeStack
Keep track of document structure  | 
| Constructor Summary | |
Parser2XMLASTAdapter(XMLTokenTypeManager tokenManager)
Creates a new adapter using tokenManager. | 
|
| Method Summary | |
 XMLAST | 
getAST()
Gets the XMLAST created by this adapter. | 
 boolean | 
getIgnoreAllWhiteSpace()
Gets property described in setIgnoreAllWhiteSpace(boolean). | 
 boolean | 
getTreatValidWhiteSpaceAsIgnorable()
Gets property described in setTreatValidWhiteSpaceAsIgnorable(boolean). | 
abstract  void | 
parse(InputStream in)
Parses a XML from an input stream  | 
abstract  void | 
parse(Reader in)
Parses a XML from a reader.  | 
 void | 
parse(String in)
Parses a XML from a string.  | 
 void | 
setIgnoreAllWhiteSpace(boolean ignoreAllWhiteSpace)
Sets if all whitespace is ignored.  | 
 void | 
setTreatValidWhiteSpaceAsIgnorable(boolean treatValidWhiteSpaceAsIgnorable)
Sets if valid whitespace is treated like ignoreable whitespace.  | 
protected  void | 
tellEndElement(String name)
Tells this adapter to that the current element now closes.  | 
protected  void | 
tellPCDATA(String pcdata)
Tells this adapter to create an XMLAST out of parseable 
 character data and link it to the tree returned by getAST(). 
  | 
protected  void | 
tellStartDocument()
Tells this adapter that the XML document has started.  | 
protected  void | 
tellStartElement(String name,
                 Attributes attributes)
Tells this adapter to created and link an XMLStartAST out of a start tag. | 
protected  void | 
tellWhiteSpace(String pcdata)
Tells this adapter to create an XMLAST out of this whitespace 
 and link it to the tree returned by getAST(). 
  | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
protected XMLAST tree
protected Stack treeStack
protected XMLTokenTypeManager tokenManager
| Constructor Detail | 
public Parser2XMLASTAdapter(XMLTokenTypeManager tokenManager)
tokenManager.
tokenManager - the token manager to determine token types for token
 generation| Method Detail | 
public abstract void parse(Reader in)
                    throws XPAParseException
in - the reader to parse from
XPAParseException
public abstract void parse(InputStream in)
                    throws XPAParseException
in - the input stream to parse from
XPAParseException
public void parse(String in)
           throws XPAParseException
in - the string to parse
XPAParseExceptionpublic 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).
public XMLAST getAST()
XMLAST created by this adapter.
protected void tellPCDATA(String pcdata)
XMLAST out of parseable 
 character data and link it to the tree returned by getAST(). 
 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), 
getAST()protected void tellWhiteSpace(String pcdata)
XMLAST out of this whitespace 
 and link it to the tree returned by getAST(). 
 In fact this 
 adapter will only create and link an an XMLAST out of it if 
 not forbidden by 
 setIgnoreAllWhiteSpace(boolean). Also, if the underlying token manager
 has no type for whitespace, no XMLAST will be added.
setIgnoreAllWhiteSpace(boolean), 
getAST()protected void tellStartDocument()
protected void tellStartElement(String name,
                                Attributes attributes)
XMLStartAST out of a start tag.
name - name of this start tagattributes - attributes associated to this start taggetAST()protected void tellEndElement(String name)
AST for this, as ends of elements
 are implied by the structure of the generated XMLAST.
name - name of this end tag
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||