org.apache.tika.sax
Class ExpandedTitleContentHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.tika.sax.ContentHandlerDecorator
          extended by org.apache.tika.sax.ExpandedTitleContentHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class ExpandedTitleContentHandler
extends ContentHandlerDecorator

Content handler decorator which wraps a TransformerHandler in order to allow the TITLE tag to render as <title></title> rather than <title/> which is accomplished by calling the ContentHandler.characters(char[], int, int) method with a length of 1 but a zero length char array.

This workaround is an unfortunate circumstance of the limitations imposed by the implementation of the XML serialization code in the JDK brought over from the xalan project which no longer allows for the specification of an alternate content-handler via xslt templates or other means.

See Also:
TIKA-725

Constructor Summary
ExpandedTitleContentHandler()
           
ExpandedTitleContentHandler(ContentHandler handler)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(String uri, String localName, String qName)
           
 void startDocument()
           
 void startElement(String uri, String localName, String qName, Attributes atts)
           
 
Methods inherited from class org.apache.tika.sax.ContentHandlerDecorator
endDocument, endPrefixMapping, handleException, ignorableWhitespace, processingInstruction, setContentHandler, setDocumentLocator, skippedEntity, startPrefixMapping, toString
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpandedTitleContentHandler

public ExpandedTitleContentHandler()

ExpandedTitleContentHandler

public ExpandedTitleContentHandler(ContentHandler handler)
Method Detail

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class ContentHandlerDecorator
Throws:
SAXException

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class ContentHandlerDecorator
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class ContentHandlerDecorator
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class ContentHandlerDecorator
Throws:
SAXException


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.