org.apache.tika.parser.xml
Class AttributeMetadataHandler

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

public class AttributeMetadataHandler
extends org.xml.sax.helpers.DefaultHandler

SAX event handler that maps the contents of an XML attribute into a metadata field.

Since:
Apache Tika 0.10

Constructor Summary
AttributeMetadataHandler(String uri, String localName, Metadata metadata, String name)
           
 
Method Summary
protected  void addMetadata(String value)
          Adds the given metadata value.
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeMetadataHandler

public AttributeMetadataHandler(String uri,
                                String localName,
                                Metadata metadata,
                                String name)
Method Detail

startElement

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

addMetadata

protected void addMetadata(String value)
Adds the given metadata value. The value is ignored if it is null or empty. If the metadata entry already exists, then the given value is appended to it with a comma as the separator.

Parameters:
value - metadata value


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