public class SAXEventRecorder
extends DefaultHandler
implements LexicalHandler, DeclHandler, DTDHandler, Externalizable
Records SAX events such that they may be "replayed" at a later time. Provides
an alternative serialization approach when externalizing a DOM4J document.
Rather than serializing a document as text and re-parsing, the sax events may
be serialized instead.
Example usage:
SAXEventRecorder recorder = new SAXEventRecorder();
SAXWriter saxWriter = new SAXWriter(recorder, recorder);
saxWriter.write(document);
out.writeObject(recorder);
...
SAXEventRecorder recorder = (SAXEventRecorder)in.readObject();
SAXContentHandler saxContentHandler = new SAXContentHandler();
recorder.replay(saxContentHandler);
Document document = saxContentHandler.getDocument();
attributeDecl
public void attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
throws SAXException
characters
public void characters(char[] ch,
int start,
int end)
throws SAXException
comment
public void comment(char[] ch,
int start,
int end)
throws SAXException
elementDecl
public void elementDecl(String name,
String model)
throws SAXException
endCDATA
public void endCDATA()
throws SAXException
endDTD
public void endDTD()
throws SAXException
endDocument
public void endDocument()
throws SAXException
endElement
public void endElement(String namespaceURI,
String localName,
String qName)
throws SAXException
endEntity
public void endEntity(String name)
throws SAXException
endPrefixMapping
public void endPrefixMapping(String prefix)
throws SAXException
externalEntityDecl
public void externalEntityDecl(String name,
String publicId,
String sysId)
throws SAXException
internalEntityDecl
public void internalEntityDecl(String name,
String value)
throws SAXException
processingInstruction
public void processingInstruction(String target,
String data)
throws SAXException
readExternal
public void readExternal(ObjectInput in)
throws ClassNotFoundException,
IOException
replay
public void replay(ContentHandler handler)
throws SAXException
startCDATA
public void startCDATA()
throws SAXException
startDTD
public void startDTD(String name,
String publicId,
String systemId)
throws SAXException
startDocument
public void startDocument()
throws SAXException
startElement
public void startElement(String namespaceURI,
String localName,
String qualifiedName,
Attributes attributes)
throws SAXException
startEntity
public void startEntity(String name)
throws SAXException
startPrefixMapping
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException