fr.opensagres.xdocreport.document.preprocessor.sax
Class BufferedDocumentContentHandler<Document extends BufferedDocument>

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by fr.opensagres.xdocreport.document.preprocessor.sax.BufferedDocumentContentHandler<Document>
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Direct Known Subclasses:
DocxContentTypesDocumentContentHandler, DocxDocumentXMLRelsDocumentContentHandler, DocxNumberingDocumentContentHandler, DocxStylesDocumentContentHandler, ODTManifestXMLDocumentContentHandler, TransformedBufferedDocumentContentHandler

public class BufferedDocumentContentHandler<Document extends BufferedDocument>
extends org.xml.sax.helpers.DefaultHandler

SAX Content Handler which build a BufferedDocument from the XML source stream.


Field Summary
protected  Document bufferedDocument
           
static String CDATA_TYPE
           
 
Constructor Summary
BufferedDocumentContentHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
protected  Document createDocument()
           
 void doEndElement(String uri, String localName, String name)
           
 boolean doStartElement(String uri, String localName, String name, Attributes attributes)
           
 void endElement(String uri, String localName, String name)
           
protected  BufferedElement findParentElementInfo(BufferedElement elementInfo, String name)
           
protected  BufferedElement findParentElementInfo(String name)
           
protected  void flushCharacters(String characters)
           
 Document getBufferedDocument()
           
 BufferedElement getCurrentElement()
           
 int getElementIndex()
           
protected  boolean mustEncodeCharachers()
           
protected  void printEscaped(String source, IBufferedRegion region)
           
protected  void resetCharacters()
           
 void startDocument()
           
 void startElement(String uri, String localName, String name, Attributes attributes)
           
 void startPrefixMapping(String prefix, String uri)
           
static org.xml.sax.helpers.AttributesImpl toAttributesImpl(Attributes attributes)
          Get the SAX AttributesImpl of teh given attributes to modify attribute values.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CDATA_TYPE

public static final String CDATA_TYPE
See Also:
Constant Field Values

bufferedDocument

protected final Document extends BufferedDocument bufferedDocument
Constructor Detail

BufferedDocumentContentHandler

public BufferedDocumentContentHandler()
Method Detail

createDocument

protected Document createDocument()

getBufferedDocument

public Document getBufferedDocument()

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

startElement

public final void startElement(String uri,
                               String localName,
                               String name,
                               Attributes attributes)
                        throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

getCurrentElement

public BufferedElement getCurrentElement()

findParentElementInfo

protected BufferedElement findParentElementInfo(String name)

findParentElementInfo

protected BufferedElement findParentElementInfo(BufferedElement elementInfo,
                                                String name)

doStartElement

public boolean doStartElement(String uri,
                              String localName,
                              String name,
                              Attributes attributes)
                       throws SAXException
Throws:
SAXException

endElement

public final void endElement(String uri,
                             String localName,
                             String name)
                      throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

doEndElement

public void doEndElement(String uri,
                         String localName,
                         String name)
                  throws SAXException
Throws:
SAXException

characters

public final void characters(char[] ch,
                             int start,
                             int length)
                      throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

mustEncodeCharachers

protected boolean mustEncodeCharachers()

flushCharacters

protected void flushCharacters(String characters)

resetCharacters

protected void resetCharacters()

toAttributesImpl

public static org.xml.sax.helpers.AttributesImpl toAttributesImpl(Attributes attributes)
Get the SAX AttributesImpl of teh given attributes to modify attribute values.

Parameters:
attributes -
Returns:

printEscaped

protected void printEscaped(String source,
                            IBufferedRegion region)

getElementIndex

public int getElementIndex()


Copyright © 2013. All rights reserved.