|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.fikin.xml.sax.PipeHandler net.sf.fikin.xml.sax.BufferingPipe
public class BufferingPipe
SAX Pipe with ability to buffer SAX events into BufferingPipe(Object)
object.
This is a genuine pipe element piping incoming SAX events to the assigned handler object.
But it allow for a temporary diverting of the events into a BufferHandler
object.
One can think of it as XML sub-tree splitter. When bufferInto(BufferHandler)
is called it diverts the following XML sub-tree into the buffer and then resumes
sending to the original handler (specified during construction time BufferingPipe(Object)
.
It counts all start-end element events and keeps track of the element's depth
in order to do that.
When bufferInto(BufferHandler)
is called, it will remember current
element's depth and pipe's hanlders and will replace them with given buffer.
All consequent events will be forwarded to the buffer.
When events related to the inner XML elements are all received it will restore original pipe's hanlders automatically and continue forwarding events to them. created on Aug 17, 2006
Field Summary | |
---|---|
protected BufferHandler |
buffer
buffering object |
protected int |
elementDepth
currently parsed element depth |
protected boolean |
inBufferMode
flag which if true this pipe is in buffering mode |
protected int |
markedDepth
elements depth when buffering occured |
Constructor Summary | |
---|---|
BufferingPipe()
|
|
BufferingPipe(java.lang.Object handler)
Construct a pipe forwarding all events to given handler |
Method Summary | |
---|---|
void |
bufferInto(BufferHandler buffer)
buffer all following events into given buffer. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
decreate nested elements counter and delegate to piped object |
protected void |
exitBufferingMode()
exit buffering mode. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
increate nested elements counter and delegate to piped object |
Methods inherited from class net.sf.fikin.xml.sax.PipeHandler |
---|
characters, characters, comment, comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, error, fatalError, getContentHandler, getDocumentLocator, getDTDHandler, getErrorHandler, getLexicalHandler, ignorableWhitespace, ignorableWhitespace, notationDecl, processingInstruction, setContentHandler, setDocumentLocator, setDTDHandler, setErrorHandler, setHandler, setLexicalHandler, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean inBufferMode
protected int markedDepth
protected int elementDepth
protected BufferHandler buffer
Constructor Detail |
---|
public BufferingPipe()
public BufferingPipe(java.lang.Object handler)
handler
- is an object implementing any or all of the following
interfaces: DTDHandler, ContentHandler, ErrorHandler, LexicalHandlerMethod Detail |
---|
public void bufferInto(BufferHandler buffer)
buffer
- protected void exitBufferingMode()
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class PipeHandler
org.xml.sax.SAXException
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class PipeHandler
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |