Package org.outerj.daisy.diff.helper
Class SaxBuffer
- java.lang.Object
-
- org.outerj.daisy.diff.helper.SaxBuffer
-
- All Implemented Interfaces:
Serializable
,ContentHandler
,LexicalHandler
public class SaxBuffer extends Object implements ContentHandler, LexicalHandler, Serializable
A class that can record SAX events and replay them later.This class was copied form the Apache Cocoon.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SaxBuffer.Characters
static class
SaxBuffer.Comment
static class
SaxBuffer.EndCDATA
static class
SaxBuffer.EndDocument
static class
SaxBuffer.EndDTD
static class
SaxBuffer.EndElement
static class
SaxBuffer.EndEntity
static class
SaxBuffer.EndPrefixMapping
static class
SaxBuffer.IgnorableWhitespace
static class
SaxBuffer.PI
static interface
SaxBuffer.SaxBit
SaxBit is a representation of the SAX event.static class
SaxBuffer.SkippedEntity
static class
SaxBuffer.StartCDATA
static class
SaxBuffer.StartDocument
static class
SaxBuffer.StartDTD
static class
SaxBuffer.StartElement
static class
SaxBuffer.StartEntity
static class
SaxBuffer.StartPrefixMapping
-
Field Summary
Fields Modifier and Type Field Description protected List<SaxBuffer.SaxBit>
saxbits
Stores list ofSaxBuffer.SaxBit
objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addBit(SaxBuffer.SaxBit bit)
Adds a SaxBit to the bits listprotected Iterator
bits()
Iterates through the bits listvoid
characters(char[] ch, int start, int length)
void
comment(char[] ch, int start, int length)
void
dump(Writer writer)
void
endCDATA()
void
endDocument()
void
endDTD()
void
endElement(String namespaceURI, String localName, String qName)
void
endEntity(String name)
void
endPrefixMapping(String prefix)
List<SaxBuffer.SaxBit>
getBits()
void
ignorableWhitespace(char[] ch, int start, int length)
boolean
isEmpty()
void
processingInstruction(String target, String data)
void
recycle()
void
setDocumentLocator(Locator locator)
void
skippedEntity(String name)
void
startCDATA()
void
startDocument()
void
startDTD(String name, String publicId, String systemId)
void
startElement(String namespaceURI, String localName, String qName, Attributes atts)
void
startEntity(String name)
void
startPrefixMapping(String prefix, String uri)
void
toSAX(ContentHandler contentHandler)
String
toString()
-
-
-
Field Detail
-
saxbits
protected List<SaxBuffer.SaxBit> saxbits
Stores list ofSaxBuffer.SaxBit
objects.
-
-
Constructor Detail
-
SaxBuffer
public SaxBuffer()
Creates empty SaxBuffer
-
SaxBuffer
public SaxBuffer(SaxBuffer saxBuffer)
Creates copy of another SaxBuffer
-
-
Method Detail
-
skippedEntity
public void skippedEntity(String name) throws SAXException
- Specified by:
skippedEntity
in interfaceContentHandler
- Throws:
SAXException
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
- Specified by:
setDocumentLocator
in interfaceContentHandler
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
- Specified by:
ignorableWhitespace
in interfaceContentHandler
- Throws:
SAXException
-
processingInstruction
public void processingInstruction(String target, String data) throws SAXException
- Specified by:
processingInstruction
in interfaceContentHandler
- Throws:
SAXException
-
startDocument
public void startDocument() throws SAXException
- Specified by:
startDocument
in interfaceContentHandler
- Throws:
SAXException
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
- Specified by:
startElement
in interfaceContentHandler
- Throws:
SAXException
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
- Specified by:
endPrefixMapping
in interfaceContentHandler
- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) throws SAXException
- Specified by:
characters
in interfaceContentHandler
- Throws:
SAXException
-
endElement
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
- Specified by:
endElement
in interfaceContentHandler
- Throws:
SAXException
-
endDocument
public void endDocument() throws SAXException
- Specified by:
endDocument
in interfaceContentHandler
- Throws:
SAXException
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
- Specified by:
startPrefixMapping
in interfaceContentHandler
- Throws:
SAXException
-
endCDATA
public void endCDATA() throws SAXException
- Specified by:
endCDATA
in interfaceLexicalHandler
- Throws:
SAXException
-
comment
public void comment(char[] ch, int start, int length) throws SAXException
- Specified by:
comment
in interfaceLexicalHandler
- Throws:
SAXException
-
startEntity
public void startEntity(String name) throws SAXException
- Specified by:
startEntity
in interfaceLexicalHandler
- Throws:
SAXException
-
endDTD
public void endDTD() throws SAXException
- Specified by:
endDTD
in interfaceLexicalHandler
- Throws:
SAXException
-
startDTD
public void startDTD(String name, String publicId, String systemId) throws SAXException
- Specified by:
startDTD
in interfaceLexicalHandler
- Throws:
SAXException
-
startCDATA
public void startCDATA() throws SAXException
- Specified by:
startCDATA
in interfaceLexicalHandler
- Throws:
SAXException
-
endEntity
public void endEntity(String name) throws SAXException
- Specified by:
endEntity
in interfaceLexicalHandler
- Throws:
SAXException
-
addBit
protected final void addBit(SaxBuffer.SaxBit bit)
Adds a SaxBit to the bits list
-
bits
protected final Iterator bits()
Iterates through the bits list
-
isEmpty
public boolean isEmpty()
-
getBits
public List<SaxBuffer.SaxBit> getBits()
-
toSAX
public void toSAX(ContentHandler contentHandler) throws SAXException
- Throws:
SAXException
-
recycle
public void recycle()
-
dump
public void dump(Writer writer) throws IOException
- Throws:
IOException
-
-