org.apache.tika.sax
Class ElementMappingContentHandler

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

public class ElementMappingContentHandler
extends ContentHandlerDecorator

Content handler decorator that maps element QNames using a Map. Not mappable elements are not forwarded. Attributes may also be mapped (for each element different using a Map for attributes), not mappable attributes are not forwarded. The default is to not map any attributes and therefore do not forward any of them.


Nested Class Summary
static class ElementMappingContentHandler.TargetElement
           
 
Constructor Summary
ElementMappingContentHandler(ContentHandler handler, Map<QName,ElementMappingContentHandler.TargetElement> mappings)
           
 
Method Summary
 void endElement(String namespaceURI, String localName, String qName)
           
protected static String getQNameAsString(QName qname)
           
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
           
 
Methods inherited from class org.apache.tika.sax.ContentHandlerDecorator
characters, endDocument, endPrefixMapping, handleException, ignorableWhitespace, processingInstruction, setContentHandler, setDocumentLocator, skippedEntity, startDocument, 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

ElementMappingContentHandler

public ElementMappingContentHandler(ContentHandler handler,
                                    Map<QName,ElementMappingContentHandler.TargetElement> mappings)
Method Detail

startElement

public void startElement(String namespaceURI,
                         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 namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class ContentHandlerDecorator
Throws:
SAXException

getQNameAsString

protected static final String getQNameAsString(QName qname)


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