Class ElementMetadataHandler

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public class ElementMetadataHandler
    extends org.xml.sax.helpers.DefaultHandler
    SAX event handler that maps the contents of an XML element into a metadata field.
    Since:
    Apache Tika 0.10
    • Constructor Summary

      Constructors 
      Constructor Description
      ElementMetadataHandler​(java.lang.String uri, java.lang.String localName, Metadata metadata, java.lang.String name)
      Constructor for string metadata keys.
      ElementMetadataHandler​(java.lang.String uri, java.lang.String localName, Metadata metadata, java.lang.String name, boolean allowDuplicateValues, boolean allowEmptyValues)
      Constructor for string metadata keys which allows change of behavior for duplicate and empty entry values.
      ElementMetadataHandler​(java.lang.String uri, java.lang.String localName, Metadata metadata, Property targetProperty)
      Constructor for Property metadata keys.
      ElementMetadataHandler​(java.lang.String uri, java.lang.String localName, Metadata metadata, Property targetProperty, boolean allowDuplicateValues, boolean allowEmptyValues)
      Constructor for Property metadata keys which allows change of behavior for duplicate and empty entry values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(char[] ch, int start, int length)  
      void endElement​(java.lang.String uri, java.lang.String localName, java.lang.String name)  
      void ignorableWhitespace​(char[] ch, int start, int length)  
      void startElement​(java.lang.String uri, java.lang.String localName, java.lang.String name, org.xml.sax.Attributes attributes)  
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        endDocument, endPrefixMapping, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ElementMetadataHandler

        public ElementMetadataHandler​(java.lang.String uri,
                                      java.lang.String localName,
                                      Metadata metadata,
                                      java.lang.String name)
        Constructor for string metadata keys.
        Parameters:
        uri - the uri of the namespace of the element
        localName - the local name of the element
        metadata - the Tika metadata object to populate
        name - the Tika metadata field key
      • ElementMetadataHandler

        public ElementMetadataHandler​(java.lang.String uri,
                                      java.lang.String localName,
                                      Metadata metadata,
                                      java.lang.String name,
                                      boolean allowDuplicateValues,
                                      boolean allowEmptyValues)
        Constructor for string metadata keys which allows change of behavior for duplicate and empty entry values.
        Parameters:
        uri - the uri of the namespace of the element
        localName - the local name of the element
        metadata - the Tika metadata object to populate
        name - the Tika metadata field key
        allowDuplicateValues - add duplicate values to the Tika metadata
        allowEmptyValues - add empty values to the Tika metadata
      • ElementMetadataHandler

        public ElementMetadataHandler​(java.lang.String uri,
                                      java.lang.String localName,
                                      Metadata metadata,
                                      Property targetProperty)
        Constructor for Property metadata keys.
        Parameters:
        uri - the uri of the namespace of the element
        localName - the local name of the element
        metadata - the Tika metadata object to populate
        targetProperty - the Tika metadata Property key
      • ElementMetadataHandler

        public ElementMetadataHandler​(java.lang.String uri,
                                      java.lang.String localName,
                                      Metadata metadata,
                                      Property targetProperty,
                                      boolean allowDuplicateValues,
                                      boolean allowEmptyValues)
        Constructor for Property metadata keys which allows change of behavior for duplicate and empty entry values.
        Parameters:
        uri - the uri of the namespace of the element
        localName - the local name of the element
        metadata - the Tika metadata object to populate
        targetProperty - the Tika metadata Property key
        allowDuplicateValues - add duplicate values to the Tika metadata
        allowEmptyValues - add empty values to the Tika metadata
    • Method Detail

      • startElement

        public void startElement​(java.lang.String uri,
                                 java.lang.String localName,
                                 java.lang.String name,
                                 org.xml.sax.Attributes attributes)
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.DefaultHandler
      • endElement

        public void endElement​(java.lang.String uri,
                               java.lang.String localName,
                               java.lang.String name)
        Specified by:
        endElement in interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.xml.sax.helpers.DefaultHandler
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
        Specified by:
        characters in interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.xml.sax.helpers.DefaultHandler
      • ignorableWhitespace

        public void ignorableWhitespace​(char[] ch,
                                        int start,
                                        int length)
        Specified by:
        ignorableWhitespace in interface org.xml.sax.ContentHandler
        Overrides:
        ignorableWhitespace in class org.xml.sax.helpers.DefaultHandler