@SuppressWarnings("resource")
    public void extract(InputStream input, XHTMLContentHandler xhtml, Metadata metadata)
            throws IOException, SAXException, TikaException {

        POIFSFileSystem pfs = new POIFSFileSystem(input);
        DirectoryNode rootNode = pfs.getRoot();
        if (rootNode == null || !rootNode.hasEntry(OLE_DOCUMENT_NAME)) {
            throw new UnsupportedFormatException(
                    "Unsupported QuattroPro file format. " + "Looking for OLE entry \"" +
                            OLE_DOCUMENT_NAME + "\". Found: " +
                            (rootNode == null ? "null" : rootNode.getEntryNames()));
        }

        //TODO shall we validate and throw warning/error if the file does not
        //start with a BOF and ends with a EOF?
        xhtml.startElement("p");
        try (WPInputStream in = new WPInputStream(
                pfs.createDocumentInputStream(OLE_DOCUMENT_NAME))) {
            Context ctx = new Context(in, xhtml, metadata);
            while (hasNext(in)) {
                ctx.type = in.readWPShort();
                ctx.bodyLength = in.readWPShort();
                Extractor extractor = EXTRACTORS.get(ctx.type);
                if (extractor != null) {
                    extractor.extract(ctx);
                } else {
                    // Use DEBUG to find out what we are ignoring
//                    Extractor.DEBUG.extract(ctx);
                    Extractor.IGNORE.extract(ctx);
                }
            }
        }
        xhtml.endElement("p");
    }
Extracts text from a Quattro Pro document according to QPW v9 File Format.
This format appears to be compatible with more recent versions too.

@author Pascal Essiembre
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/wordperfect/QPWTextExtractor.java