|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.simonstl.gorille.Ripper
A context-aware processor for manipulating markup labels and content.
Note that this processor does no DOCTYPE processing.
This code is based on the parser from the Tiny API for Markup (TAM), but
reports a text version of the document with context rather than abstracting
it so heavily to nodes. For more detail on the events that Ripper produces,
see the DocProcI
class.
This class is not particularly elegant, using methods to isolate code for editorial
convenience but relying on variables which are global to the class for most
communications inside of the parser. This will improve with time, hopefully.
The easiest way to use this class is to create a Ripper object and assign a handler
(and possibly a context, if you want to use one other than the default), then call the
parse() method with an appropriate InputStream.
This parser does not presently understand character encodings, and in fact regards
the XML declaration as a processing instruction. This will also improve with time.
Field Summary | |
protected java.util.ArrayList |
attributes
|
Constructor Summary | |
Ripper()
Creates a new instance of Ripper |
Method Summary | |
protected void |
error(java.lang.String s)
errors are reported and processing halts |
protected void |
fatalError(java.lang.String s)
fatal errors are reported and processing halts |
ContextI |
getContext()
|
int |
getDiagLimit()
|
boolean |
getFeature(java.lang.String name)
|
DocProcI |
getHandler()
|
protected int |
internalProcessAmpersand(int state)
|
protected int |
internalProcessEntities(char currentChar,
int state)
|
protected void |
lineEndNorm(char currentChar,
int state)
|
void |
parse(java.io.Reader r)
|
protected int |
processAmpersand(int state)
|
protected int |
processCDATA(char currentChar,
int state)
|
protected int |
processComments(char currentChar,
int state)
|
protected int |
processDOCTYPE(char currentChar,
int state)
|
protected int |
processEndTag(char currentChar,
int state)
|
protected int |
processEntities(char currentChar,
int state)
|
protected int |
processPIs(char currentChar,
int state)
|
protected int |
processStartTagCollecting(char currentChar,
int state)
|
protected void |
processStartTagForContext(char currentChar)
|
protected void |
processStartTagForReporting(char currentChar)
|
protected int |
processXMLDecl(char currentChar,
int state)
|
void |
setContext(ContextI context)
|
void |
setDiagLimit(int limit)
|
void |
setFeature(java.lang.String name,
boolean value)
|
void |
setHandler(DocProcI _handler)
|
void |
setMaxBuf(int _size)
|
protected void |
startTagDone()
|
protected void |
warning(java.lang.String s)
warnings are reported and processing continues |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.ArrayList attributes
Constructor Detail |
public Ripper()
Method Detail |
public void setMaxBuf(int _size)
public DocProcI getHandler()
public void setHandler(DocProcI _handler)
public void parse(java.io.Reader r) throws GorilleException
GorilleException
protected int processAmpersand(int state) throws GorilleException
GorilleException
protected int internalProcessAmpersand(int state) throws GorilleException
GorilleException
protected int processDOCTYPE(char currentChar, int state) throws GorilleException
GorilleException
protected int processComments(char currentChar, int state) throws GorilleException
GorilleException
protected int processCDATA(char currentChar, int state) throws GorilleException
GorilleException
protected int processXMLDecl(char currentChar, int state) throws GorilleException
GorilleException
protected int processPIs(char currentChar, int state) throws GorilleException
GorilleException
protected int processEndTag(char currentChar, int state) throws GorilleException
GorilleException
protected int processStartTagCollecting(char currentChar, int state) throws GorilleException
GorilleException
protected void processStartTagForContext(char currentChar) throws GorilleException
GorilleException
protected void startTagDone()
protected void processStartTagForReporting(char currentChar) throws GorilleException
GorilleException
protected int processEntities(char currentChar, int state) throws GorilleException
GorilleException
protected int internalProcessEntities(char currentChar, int state) throws GorilleException
GorilleException
protected void lineEndNorm(char currentChar, int state)
protected void fatalError(java.lang.String s) throws GorilleException
GorilleException
protected void error(java.lang.String s) throws GorilleException
GorilleException
protected void warning(java.lang.String s) throws GorilleException
GorilleException
public void setFeature(java.lang.String name, boolean value)
public boolean getFeature(java.lang.String name)
public void setContext(ContextI context)
public ContextI getContext()
public void setDiagLimit(int limit)
public int getDiagLimit()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |