com.simonstl.gorille
Interface DocProcI

All Known Implementing Classes:
DocProcCollector, DocProcImpl, DocProcReporter

public interface DocProcI

The docProcI interface provides access to low-level information in an XML (or other markup, since this processing works below even the well-formedness processing in an XML parser. All information is passed as StringBuffer objects and returned as (possibly changed) StringBuffer objects. The context object provides the element/attribute context as well as the current namespace declaration stack.

One issue in particular is worth noting. Namespace declarations may not appear until after the first use of an element in that namespace. This is an unfortunate side-effect of the attribute-based syntax used by Namespaces in XML. A look-ahead strategy and two context trees (one reflecting the initial document, one reflecting the result) may correct this in the future.

Author:
simonstl

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 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.
 

Method Detail

setContext

public void setContext(ContextI context)
setContext() connects this processor to a particular context object coming from the parser.


getContext

public ContextI getContext()
getContext() is useful if you need to chain one processor to another and connect the contexts.


setChainListener

public 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.


getChainListener

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


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.

GorilleException

DOCTYPE

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

GorilleException

startElementOTag

public java.lang.StringBuffer startElementOTag(java.lang.StringBuffer content)
                                        throws GorilleException
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.

GorilleException

startElementCTag

public java.lang.StringBuffer startElementCTag(java.lang.StringBuffer content)
                                        throws GorilleException
Indicates that the parser has begun reading a closing tag. The StringBuffer content will always contain "
GorilleException

elementName

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

GorilleException

tagSpace

public java.lang.StringBuffer tagSpace(java.lang.StringBuffer content)
                                throws GorilleException
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.

GorilleException

attName

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

GorilleException

attEquals

public java.lang.StringBuffer attEquals(java.lang.StringBuffer content)
                                 throws GorilleException
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.

GorilleException

attStartQuote

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

GorilleException

attEndQuote

public java.lang.StringBuffer attEndQuote(java.lang.StringBuffer content)
                                   throws GorilleException
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 '.

GorilleException

endElementOTag

public java.lang.StringBuffer endElementOTag(java.lang.StringBuffer content)
                                      throws GorilleException
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.

GorilleException

endElementETag

public java.lang.StringBuffer endElementETag(java.lang.StringBuffer content)
                                      throws GorilleException
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.

GorilleException

endElementCTag

public java.lang.StringBuffer endElementCTag(java.lang.StringBuffer content)
                                      throws GorilleException
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.

GorilleException

chars

public java.lang.StringBuffer chars(java.lang.StringBuffer content)
                             throws GorilleException
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.

GorilleException

decCharRef

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

GorilleException

hexCharRef

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

GorilleException

entRef

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

GorilleException

commentStart

public java.lang.StringBuffer commentStart(java.lang.StringBuffer content)
                                    throws GorilleException
Reports the beginning of comments. The StringBuffer content will contain the opening "

commentContent

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

GorilleException

commentEnd

public java.lang.StringBuffer commentEnd(java.lang.StringBuffer content)
                                  throws GorilleException
Reports comments. The StringBuffer content will contain the closing "-->"

GorilleException

PIStart

public java.lang.StringBuffer PIStart(java.lang.StringBuffer content)
                               throws GorilleException
Reports that a processing instruction has started. The StringBuffer content will contain the opening - "
GorilleException

PITarget

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

GorilleException

PISpace

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

GorilleException

PIData

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

GorilleException

PIEnd

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

GorilleException

CDATAStart

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

GorilleException

CDATAEnd

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

GorilleException

warning

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

GorilleException

error

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

GorilleException

fatalError

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

GorilleException