org.dom4j.io
Class SAXEventRecorder
java.lang.Object
   org.xml.sax.helpers.DefaultHandler
org.xml.sax.helpers.DefaultHandler
       org.dom4j.io.SAXEventRecorder
org.dom4j.io.SAXEventRecorder
- All Implemented Interfaces: 
- ContentHandler, DeclHandler, DTDHandler, EntityResolver, ErrorHandler, Externalizable, LexicalHandler, Serializable
- 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();
  
   
  
 
- Author:
- Todd Wolff (Bluestem Software)
- See Also:
- Serialized Form
 
 
| Method Summary | 
|  void | attributeDecl(String eName,
              String aName,
              String type,
              String valueDefault,
              String value)
 | 
|  void | characters(char[] ch,
           int start,
           int end)
 | 
|  void | comment(char[] ch,
        int start,
        int end)
 | 
|  void | elementDecl(String name,
            String model)
 | 
|  void | endCDATA()
 | 
|  void | endDocument()
 | 
|  void | endDTD()
 | 
|  void | endElement(String namespaceURI,
           String localName,
           String qName)
 | 
|  void | endEntity(String name)
 | 
|  void | endPrefixMapping(String prefix)
 | 
|  void | externalEntityDecl(String name,
                   String publicId,
                   String sysId)
 | 
|  void | internalEntityDecl(String name,
                   String value)
 | 
|  void | processingInstruction(String target,
                      String data)
 | 
|  void | readExternal(ObjectInput in)
 | 
|  void | replay(ContentHandler handler)
 | 
|  void | startCDATA()
 | 
|  void | startDocument()
 | 
|  void | startDTD(String name,
         String publicId,
         String systemId)
 | 
|  void | startElement(String namespaceURI,
             String localName,
             String qualifiedName,
             Attributes attributes)
 | 
|  void | startEntity(String name)
 | 
|  void | startPrefixMapping(String prefix,
                   String uri)
 | 
|  void | writeExternal(ObjectOutput out)
 | 
 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
 
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
SAXEventRecorder
public SAXEventRecorder()
replay
public void replay(ContentHandler handler)
            throws SAXException
- 
 
- 
- Throws:
- SAXException
 
processingInstruction
public void processingInstruction(String target,
                                  String data)
                           throws SAXException
- 
- Specified by:
- processingInstructionin interface- ContentHandler
 
- 
- Throws:
- SAXException
 
startPrefixMapping
public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
- 
- Specified by:
- startPrefixMappingin interface- ContentHandler
 
- 
- Throws:
- SAXException
 
endPrefixMapping
public void endPrefixMapping(String prefix)
                      throws SAXException
- 
- Specified by:
- endPrefixMappingin interface- ContentHandler
 
- 
- Throws:
- SAXException
 
startDocument
public void startDocument()
                   throws SAXException
- 
- Specified by:
- startDocumentin interface- ContentHandler
 
- 
- Throws:
- SAXException
 
endDocument
public void endDocument()
                 throws SAXException
- 
- Specified by:
- endDocumentin interface- ContentHandler
 
- 
- Throws:
- SAXException
 
startElement
public void startElement(String namespaceURI,
                         String localName,
                         String qualifiedName,
                         Attributes attributes)
                  throws SAXException
- 
- Specified by:
- startElementin interface- ContentHandler
 
- 
- Throws:
- SAXException
 
endElement
public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
- 
- Specified by:
- endElementin interface- ContentHandler
 
- 
- Throws:
- SAXException
 
characters
public void characters(char[] ch,
                       int start,
                       int end)
                throws SAXException
- 
- Specified by:
- charactersin interface- ContentHandler
 
- 
- Throws:
- SAXException
 
startDTD
public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
- 
- Specified by:
- startDTDin interface- LexicalHandler
 
- 
- Throws:
- SAXException
 
endDTD
public void endDTD()
            throws SAXException
- 
- Specified by:
- endDTDin interface- LexicalHandler
 
- 
- Throws:
- SAXException
 
startEntity
public void startEntity(String name)
                 throws SAXException
- 
- Specified by:
- startEntityin interface- LexicalHandler
 
- 
- Throws:
- SAXException
 
endEntity
public void endEntity(String name)
               throws SAXException
- 
- Specified by:
- endEntityin interface- LexicalHandler
 
- 
- Throws:
- SAXException
 
startCDATA
public void startCDATA()
                throws SAXException
- 
- Specified by:
- startCDATAin interface- LexicalHandler
 
- 
- Throws:
- SAXException
 
endCDATA
public void endCDATA()
              throws SAXException
- 
- Specified by:
- endCDATAin interface- LexicalHandler
 
- 
- Throws:
- SAXException
 
comment
public void comment(char[] ch,
                    int start,
                    int end)
             throws SAXException
- 
- Specified by:
- commentin interface- LexicalHandler
 
- 
- Throws:
- SAXException
 
elementDecl
public void elementDecl(String name,
                        String model)
                 throws SAXException
- 
- Specified by:
- elementDeclin interface- DeclHandler
 
- 
- Throws:
- SAXException
 
attributeDecl
public void attributeDecl(String eName,
                          String aName,
                          String type,
                          String valueDefault,
                          String value)
                   throws SAXException
- 
- Specified by:
- attributeDeclin interface- DeclHandler
 
- 
- Throws:
- SAXException
 
internalEntityDecl
public void internalEntityDecl(String name,
                               String value)
                        throws SAXException
- 
- Specified by:
- internalEntityDeclin interface- DeclHandler
 
- 
- Throws:
- SAXException
 
externalEntityDecl
public void externalEntityDecl(String name,
                               String publicId,
                               String sysId)
                        throws SAXException
- 
- Specified by:
- externalEntityDeclin interface- DeclHandler
 
- 
- Throws:
- SAXException
 
writeExternal
public void writeExternal(ObjectOutput out)
                   throws IOException
- 
- Specified by:
- writeExternalin interface- Externalizable
 
- 
- Throws:
- IOException
 
readExternal
public void readExternal(ObjectInput in)
                  throws ClassNotFoundException,
                         IOException
- 
- Specified by:
- readExternalin interface- Externalizable
 
- 
- Throws:
- ClassNotFoundException
- IOException
 
Copyright © 2001-2005 MetaStuff Ltd.. All Rights Reserved.