Class AbstractOOXMLExtractor
java.lang.Object
org.apache.tika.parser.microsoft.ooxml.AbstractOOXMLExtractor
- All Implemented Interfaces:
OOXMLExtractor
- Direct Known Subclasses:
POIXMLTextExtractorDecorator,SXSLFPowerPointExtractorDecorator,SXWPFWordExtractorDecorator,XPSExtractorDecorator,XSLFPowerPointExtractorDecorator,XSSFExcelExtractorDecorator,XWPFWordExtractorDecorator
Base class for all Tika OOXML extractors.
Tika extractors decorate POI extractors so that the parsed content of
documents is returned as a sequence of XHTML SAX events. Subclasses must
implement the buildXHTML method
buildXHTML(XHTMLContentHandler) that
populates the XHTMLContentHandler object received as parameter.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OfficeParserConfigprotected static final String[]protected org.apache.poi.ooxml.extractor.POIXMLTextExtractor -
Constructor Summary
ConstructorsConstructorDescriptionAbstractOOXMLExtractor(ParseContext context, org.apache.poi.ooxml.extractor.POIXMLTextExtractor extractor) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidbuildXHTML(XHTMLContentHandler xhtml) Populates theXHTMLContentHandlerobject received as parameter.org.apache.poi.ooxml.POIXMLDocumentReturns the opened document.protected Map<String,EmbeddedPartMetadata> protected StringgetJustFileName(String desc) protected abstract List<org.apache.poi.openxml4j.opc.PackagePart>Return a list of the main parts of the document, used when searching for embedded resources.POIXMLTextExtractor.getMetadataTextExtractor()not yet supported for OOXML by POI.voidgetXHTML(ContentHandler handler, Metadata metadata, ParseContext context) Parses the document into a sequence of XHTML SAX events sent to the given content handler.protected voidhandleEmbeddedFile(org.apache.poi.openxml4j.opc.PackagePart part, XHTMLContentHandler xhtml, String rel, EmbeddedPartMetadata embeddedPartMetadata, TikaCoreProperties.EmbeddedResourceType embeddedResourceType) Handles an embedded file in the documentloadLinkedRelationships(org.apache.poi.openxml4j.opc.PackagePart bodyPart, boolean includeInternal, Metadata metadata) This is used by the SAX docx and pptx decorators to load hyperlinks and other linked objects
-
Field Details
-
EMBEDDED_RELATIONSHIPS
-
config
-
extractor
protected org.apache.poi.ooxml.extractor.POIXMLTextExtractor extractor
-
-
Constructor Details
-
AbstractOOXMLExtractor
public AbstractOOXMLExtractor(ParseContext context, org.apache.poi.ooxml.extractor.POIXMLTextExtractor extractor)
-
-
Method Details
-
getDocument
public org.apache.poi.ooxml.POIXMLDocument getDocument()Description copied from interface:OOXMLExtractorReturns the opened document.- Specified by:
getDocumentin interfaceOOXMLExtractor- See Also:
-
getMetadataExtractor
Description copied from interface:OOXMLExtractorPOIXMLTextExtractor.getMetadataTextExtractor()not yet supported for OOXML by POI.- Specified by:
getMetadataExtractorin interfaceOOXMLExtractor- See Also:
-
getXHTML
public void getXHTML(ContentHandler handler, Metadata metadata, ParseContext context) throws SAXException, org.apache.xmlbeans.XmlException, IOException, TikaException Description copied from interface:OOXMLExtractorParses the document into a sequence of XHTML SAX events sent to the given content handler.- Specified by:
getXHTMLin interfaceOOXMLExtractor- Throws:
SAXExceptionorg.apache.xmlbeans.XmlExceptionIOExceptionTikaException- See Also:
-
getEmbeddedPartMetadataMap
-
getJustFileName
-
handleEmbeddedFile
protected void handleEmbeddedFile(org.apache.poi.openxml4j.opc.PackagePart part, XHTMLContentHandler xhtml, String rel, EmbeddedPartMetadata embeddedPartMetadata, TikaCoreProperties.EmbeddedResourceType embeddedResourceType) throws SAXException, IOException Handles an embedded file in the document- Throws:
SAXExceptionIOException
-
buildXHTML
protected abstract void buildXHTML(XHTMLContentHandler xhtml) throws SAXException, org.apache.xmlbeans.XmlException, IOException Populates theXHTMLContentHandlerobject received as parameter.- Throws:
SAXExceptionorg.apache.xmlbeans.XmlExceptionIOException
-
getMainDocumentParts
protected abstract List<org.apache.poi.openxml4j.opc.PackagePart> getMainDocumentParts() throws TikaExceptionReturn a list of the main parts of the document, used when searching for embedded resources. This should be all the parts of the document that end up with things embedded into them.- Throws:
TikaException
-
loadLinkedRelationships
protected Map<String,String> loadLinkedRelationships(org.apache.poi.openxml4j.opc.PackagePart bodyPart, boolean includeInternal, Metadata metadata) This is used by the SAX docx and pptx decorators to load hyperlinks and other linked objects- Parameters:
bodyPart-- Returns:
-