com.simonstl.gorille
Class DocProcCollector

java.lang.Object
  |
  +--com.simonstl.gorille.DocProcCollector
All Implemented Interfaces:
DocProcI

public class DocProcCollector
extends java.lang.Object
implements DocProcI

DocProcCollector stores event information in a StringBuffer, which can be printed using the print() method.


Field Summary
protected  java.lang.StringBuffer collects
           
protected  ContextI context
           
protected  DocProcI listener
           
 
Constructor Summary
DocProcCollector()
           
 
Method Summary
 java.lang.StringBuffer attEndQuote(java.lang.StringBuffer content)
          Reports the end quote type of an attribute described by the current tag.
 java.lang.StringBuffer attEquals(java.lang.StringBuffer content)
          Reports when the equals sign in an attribute name/value pair is encountered.
 java.lang.StringBuffer attName(java.lang.StringBuffer content)
          Reports the name of an attribute described by the current tag.
 java.lang.StringBuffer attStartQuote(java.lang.StringBuffer content)
          Reports the start quote type of an attribute described by the current tag.
 java.lang.StringBuffer CDATAEnd(java.lang.StringBuffer content)
          Reports that a CDATA section has ended.
 java.lang.StringBuffer CDATAStart(java.lang.StringBuffer content)
          Reports that a CDATA section has started.
 java.lang.StringBuffer chars(java.lang.StringBuffer content)
          Reports raw textual content contained by elements or attributes.
 java.lang.StringBuffer commentContent(java.lang.StringBuffer content)
          Reports comment contents.
 java.lang.StringBuffer commentEnd(java.lang.StringBuffer content)
          Reports comments.
 java.lang.StringBuffer commentStart(java.lang.StringBuffer content)
          Reports the beginning of comments.
 java.lang.StringBuffer decCharRef(java.lang.StringBuffer content)
          Reports decimal character references.
 java.lang.StringBuffer DOCTYPE(java.lang.StringBuffer content)
          Reports the DOCTYPE declaration, if one is present..
 java.lang.StringBuffer elementName(java.lang.StringBuffer content)
          Reports the name of the element described by the current tag.
 java.lang.StringBuffer endElementCTag(java.lang.StringBuffer content)
          Indicates that the parser has ended reading a closing tag.
 java.lang.StringBuffer endElementETag(java.lang.StringBuffer content)
          Indicates that the parser has ended reading an empty tag.
 java.lang.StringBuffer endElementOTag(java.lang.StringBuffer content)
          Indicates that the parser has ended reading an open tag.
 java.lang.StringBuffer entRef(java.lang.StringBuffer content)
          Reports entity references.
 GorilleException error(GorilleException e)
          A conduit for error messages
 GorilleException fatalError(GorilleException e)
          A conduit for fatal error messages
 DocProcI getChainListener()
          getChainListener() lets you find out which object is getting events from this processor.
 ContextI getContext()
          getContext() is useful if you need to chain one processor to another and connect the contexts.
 java.lang.StringBuffer hexCharRef(java.lang.StringBuffer content)
          Reports hexadecimal character references.
 java.lang.StringBuffer PIData(java.lang.StringBuffer content)
          Reports the data in a processing instruction.
 java.lang.StringBuffer PIEnd(java.lang.StringBuffer content)
          Reports that a processing instruction has ended.
 java.lang.StringBuffer PISpace(java.lang.StringBuffer content)
          Reports the whitespace between a processing instruction's target and its data.
 java.lang.StringBuffer PIStart(java.lang.StringBuffer content)
          Reports that a processing instruction has started.
 java.lang.StringBuffer PITarget(java.lang.StringBuffer content)
          Reports a processing instruction target.
 void print()
           
 void setChainListener(DocProcI listener)
          setChainListener() lets you set a processor which will receive the events from this processor before the information is returned to the original filter.
 void setContext(ContextI context)
          setContext() connects this processor to a particular context object coming from the parser.
 java.lang.StringBuffer startElementCTag(java.lang.StringBuffer content)
          Indicates that the parser has begun reading a closing tag.
 java.lang.StringBuffer startElementOTag(java.lang.StringBuffer content)
          Indicates that the parser has begun reading an open or empty tag.
 java.lang.StringBuffer tagSpace(java.lang.StringBuffer content)
          Reports whitespace inside of start, end, and empty tags, except whitespace contained in attribute values.
 GorilleException warning(GorilleException e)
          A conduit for warning messages
 java.lang.StringBuffer XMLdecl(java.lang.StringBuffer content)
          Reports the XML declaration, if one is present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected ContextI context

listener

protected DocProcI listener

collects

protected java.lang.StringBuffer collects
Constructor Detail

DocProcCollector

public DocProcCollector()
Method Detail

print

public void print()

setContext

public void setContext(ContextI context)
Description copied from interface: DocProcI
setContext() connects this processor to a particular context object coming from the parser.

Specified by:
setContext in interface DocProcI

getContext

public ContextI getContext()
Description copied from interface: DocProcI
getContext() is useful if you need to chain one processor to another and connect the contexts.

Specified by:
getContext in interface DocProcI

setChainListener

public void setChainListener(DocProcI listener)
Description copied from interface: DocProcI
setChainListener() lets you set a processor which will receive the events from this processor before the information is returned to the original filter.

Specified by:
setChainListener in interface DocProcI

getChainListener

public DocProcI getChainListener()
Description copied from interface: DocProcI
getChainListener() lets you find out which object is getting events from this processor.

Specified by:
getChainListener in interface DocProcI

XMLdecl

public java.lang.StringBuffer XMLdecl(java.lang.StringBuffer content)
                               throws GorilleException
Reports the XML declaration, if one is present. The StringBuffer content will contain the entire XML declaration.

Specified by:
XMLdecl in interface DocProcI
GorilleException

DOCTYPE

public java.lang.StringBuffer DOCTYPE(java.lang.StringBuffer content)
                               throws GorilleException
Description copied from interface: DocProcI
Reports the DOCTYPE declaration, if one is present.. The StringBuffer content will contain the entire DOCTYPE declaration.

Specified by:
DOCTYPE in interface DocProcI
GorilleException

startElementOTag

public java.lang.StringBuffer startElementOTag(java.lang.StringBuffer content)
                                        throws GorilleException
Description copied from interface: DocProcI
Indicates that the parser has begun reading an open or empty tag. The StringBuffer content will always contain "<" for this event if an XML document is the source of the event.

Specified by:
startElementOTag in interface DocProcI
GorilleException

startElementCTag

public java.lang.StringBuffer startElementCTag(java.lang.StringBuffer content)
                                        throws GorilleException
Description copied from interface: DocProcI
Indicates that the parser has begun reading a closing tag. The StringBuffer content will always contain "
Specified by:
startElementCTag in interface DocProcI
GorilleException

elementName

public java.lang.StringBuffer elementName(java.lang.StringBuffer content)
                                   throws GorilleException
Description copied from interface: DocProcI
Reports the name of the element described by the current tag. The StringBuffer content will always contain the name of the element.

Specified by:
elementName in interface DocProcI
GorilleException

tagSpace

public java.lang.StringBuffer tagSpace(java.lang.StringBuffer content)
                                throws GorilleException
Description copied from interface: DocProcI
Reports whitespace inside of start, end, and empty tags, except whitespace contained in attribute values. Note that element names are reported as characters (and possibly, outside of XML, entities, etc.) Collect these events and process in the tagSpace event. The StringBuffer content will contain all the space in any given whitespace area.

Specified by:
tagSpace in interface DocProcI
GorilleException

attName

public java.lang.StringBuffer attName(java.lang.StringBuffer content)
                               throws GorilleException
Description copied from interface: DocProcI
Reports the name of an attribute described by the current tag. The StringBuffer content will always contain the name of the attribute.

Specified by:
attName in interface DocProcI
GorilleException

attEquals

public java.lang.StringBuffer attEquals(java.lang.StringBuffer content)
                                 throws GorilleException
Description copied from interface: DocProcI
Reports when the equals sign in an attribute name/value pair is encountered. attribute names are reported as characters (and possibly, outside of XML, entities, etc.) Collect these events and process in the attEquals event. The StringBuffer content will always contain "="; whitespace before or after the = will be reported using the tagSpace event.

Specified by:
attEquals in interface DocProcI
GorilleException

attStartQuote

public java.lang.StringBuffer attStartQuote(java.lang.StringBuffer content)
                                     throws GorilleException
Description copied from interface: DocProcI
Reports the start quote type of an attribute described by the current tag. The StringBuffer content will always contain either " or '.

Specified by:
attStartQuote in interface DocProcI
GorilleException

attEndQuote

public java.lang.StringBuffer attEndQuote(java.lang.StringBuffer content)
                                   throws GorilleException
Description copied from interface: DocProcI
Reports the end quote type of an attribute described by the current tag. The end quote will always be the same as the start quote; this is largely a convenience method for developers who don't want to spend their time counting quotes. The StringBuffer content will always contain either " or '.

Specified by:
attEndQuote in interface DocProcI
GorilleException

endElementOTag

public java.lang.StringBuffer endElementOTag(java.lang.StringBuffer content)
                                      throws GorilleException
Description copied from interface: DocProcI
Indicates that the parser has ended reading an open tag. The StringBuffer content will always contain ">" for this event if an XML document is the source of the event.

Specified by:
endElementOTag in interface DocProcI
GorilleException

endElementETag

public java.lang.StringBuffer endElementETag(java.lang.StringBuffer content)
                                      throws GorilleException
Description copied from interface: DocProcI
Indicates that the parser has ended reading an empty tag. The StringBuffer content will always contain "/>" for this event if an XML document is the source of the event.

Specified by:
endElementETag in interface DocProcI
GorilleException

endElementCTag

public java.lang.StringBuffer endElementCTag(java.lang.StringBuffer content)
                                      throws GorilleException
Description copied from interface: DocProcI
Indicates that the parser has ended reading a closing tag. The StringBuffer content will always contain ">" for this event if an XML document is the source of the event.

Specified by:
endElementCTag in interface DocProcI
GorilleException

chars

public java.lang.StringBuffer chars(java.lang.StringBuffer content)
                             throws GorilleException
Description copied from interface: DocProcI
Reports raw textual content contained by elements or attributes. The StringBuffer content will contain characters. Parsers may report multiple chars events as necessary, and other events may be interspersed as necessary.

Specified by:
chars in interface DocProcI
GorilleException

decCharRef

public java.lang.StringBuffer decCharRef(java.lang.StringBuffer content)
                                  throws GorilleException
Description copied from interface: DocProcI
Reports decimal character references. The StringBuffer content will contain the entire reference - "@" for example.

Specified by:
decCharRef in interface DocProcI
GorilleException

hexCharRef

public java.lang.StringBuffer hexCharRef(java.lang.StringBuffer content)
                                  throws GorilleException
Description copied from interface: DocProcI
Reports hexadecimal character references. The StringBuffer content will contain the entire reference - "d" for example.

Specified by:
hexCharRef in interface DocProcI
GorilleException

entRef

public java.lang.StringBuffer entRef(java.lang.StringBuffer content)
                              throws GorilleException
Description copied from interface: DocProcI
Reports entity references. The StringBuffer content will contain the entire reference - "&" for example.

Specified by:
entRef in interface DocProcI
GorilleException

commentStart

public java.lang.StringBuffer commentStart(java.lang.StringBuffer content)
                                    throws GorilleException
Description copied from interface: DocProcI
Reports the beginning of comments. The StringBuffer content will contain the opening "

commentContent

public java.lang.StringBuffer commentContent(java.lang.StringBuffer content)
                                      throws GorilleException
Description copied from interface: DocProcI
Reports comment contents. The StringBuffer content will contain the contents of the comment. There may be multiple commentContent events if the content is long.

Specified by:
commentContent in interface DocProcI
GorilleException

commentEnd

public java.lang.StringBuffer commentEnd(java.lang.StringBuffer content)
                                  throws GorilleException
Description copied from interface: DocProcI
Reports comments. The StringBuffer content will contain the closing "-->"

Specified by:
commentEnd in interface DocProcI
GorilleException

PIStart

public java.lang.StringBuffer PIStart(java.lang.StringBuffer content)
                               throws GorilleException
Description copied from interface: DocProcI
Reports that a processing instruction has started. The StringBuffer content will contain the opening - "
Specified by:
PIStart in interface DocProcI
GorilleException

PITarget

public java.lang.StringBuffer PITarget(java.lang.StringBuffer content)
                                throws GorilleException
Description copied from interface: DocProcI
Reports a processing instruction target. The StringBuffer content will contain the target - "xml-stylesheet", for example.

Specified by:
PITarget in interface DocProcI
GorilleException

PISpace

public java.lang.StringBuffer PISpace(java.lang.StringBuffer content)
                               throws GorilleException
Description copied from interface: DocProcI
Reports the whitespace between a processing instruction's target and its data. The StringBuffer content will contain just whitespace.

Specified by:
PISpace in interface DocProcI
GorilleException

PIData

public java.lang.StringBuffer PIData(java.lang.StringBuffer content)
                              throws GorilleException
Description copied from interface: DocProcI
Reports the data in a processing instruction. The StringBuffer content will contain all of the data in one (potentially large) piece.

Specified by:
PIData in interface DocProcI
GorilleException

PIEnd

public java.lang.StringBuffer PIEnd(java.lang.StringBuffer content)
                             throws GorilleException
Description copied from interface: DocProcI
Reports that a processing instruction has ended. The StringBuffer content will contain the opening - "?>".

Specified by:
PIEnd in interface DocProcI
GorilleException

CDATAStart

public java.lang.StringBuffer CDATAStart(java.lang.StringBuffer content)
                                  throws GorilleException
Description copied from interface: DocProcI
Reports that a CDATA section has started. The StringBuffer content will contain the opening - "<[CDATA[".

Specified by:
CDATAStart in interface DocProcI
GorilleException

CDATAEnd

public java.lang.StringBuffer CDATAEnd(java.lang.StringBuffer content)
                                throws GorilleException
Description copied from interface: DocProcI
Reports that a CDATA section has ended. The StringBuffer content will contain the opening - "]]>".

Specified by:
CDATAEnd in interface DocProcI
GorilleException

warning

public GorilleException warning(GorilleException e)
                         throws GorilleException
Description copied from interface: DocProcI
A conduit for warning messages

Specified by:
warning in interface DocProcI
GorilleException

error

public GorilleException error(GorilleException e)
                       throws GorilleException
A conduit for error messages

Specified by:
error in interface DocProcI
GorilleException

fatalError

public GorilleException fatalError(GorilleException e)
                            throws GorilleException
A conduit for fatal error messages

Specified by:
fatalError in interface DocProcI
GorilleException