protected void parse(DirectoryNode root, XHTMLContentHandler xhtml)
            throws IOException, SAXException, TikaException {
        HWPFDocument document;
        try {
            document = new HWPFDocument(root);
        } catch (org.apache.poi.EncryptedDocumentException e) {
            throw new EncryptedDocumentException(e);
        } catch (OldWordFileFormatException e) {
            parseWord6(root, xhtml);
            return;
        }

        extractSavedByMetadata(document);

        org.apache.poi.hwpf.extractor.WordExtractor wordExtractor =
                new org.apache.poi.hwpf.extractor.WordExtractor(document);

        // Grab the list of pictures. As far as we can tell,
        //  the pictures should be in order, and may be directly
        //  placed or referenced from an anchor
        PicturesTable pictureTable = document.getPicturesTable();
        PicturesSource pictures = new PicturesSource(document);
        HeaderStories headerFooter = null;
        // Do any headers, if present
        if (officeParserConfig.isIncludeHeadersAndFooters()) {
            headerFooter = new HeaderStories(document);
            Range[] headers = new Range[]{headerFooter.getFirstHeaderSubrange(),
                    headerFooter.getEvenHeaderSubrange(), headerFooter.getOddHeaderSubrange()};
            handleHeaderFooter(headers, "header", document, pictures, pictureTable, xhtml);
        }
        // Do the main paragraph text
        Range r = document.getRange();
        ListManager listManager = new ListManager(document);
        for (int i = 0; i < r.numParagraphs(); i++) {
            Paragraph p = r.getParagraph(i);
            i += handleParagraph(p, 0, r, document, FieldsDocumentPart.MAIN, pictures, pictureTable,
                    listManager, xhtml);
        }

        if (officeParserConfig.isIncludeShapeBasedContent()) {
            // Do everything else
            for (String paragraph : wordExtractor.getMainTextboxText()) {
                xhtml.element("p", paragraph);
            }
        }

        for (String paragraph : wordExtractor.getFootnoteText()) {
            xhtml.element("p", paragraph);
        }

        for (String paragraph : wordExtractor.getCommentsText()) {
            xhtml.element("p", paragraph);
        }

        for (String paragraph : wordExtractor.getEndnoteText()) {
            xhtml.element("p", paragraph);
        }

        if (officeParserConfig.isIncludeHeadersAndFooters()) {
            // Do any footers, if present
            Range[] footers = new Range[]{headerFooter.getFirstFooterSubrange(),
                    headerFooter.getEvenFooterSubrange(), headerFooter.getOddFooterSubrange()};
            handleHeaderFooter(footers, "footer", document, pictures, pictureTable, xhtml);
        }
        // Handle any pictures that we haven't output yet
        for (Picture p = pictures.nextUnclaimed(); p != null; ) {
            handlePictureCharacterRun(null, p, pictures, xhtml);
            p = pictures.nextUnclaimed();
        }

        // Handle any embedded office documents
        try {

            DirectoryEntry op = (DirectoryEntry) root.getEntry("ObjectPool");
            for (Entry entry : op) {
                if (entry.getName().startsWith("_") && entry instanceof DirectoryEntry) {
                    handleEmbeddedOfficeDoc((DirectoryEntry) entry, xhtml, true);
                }
            }

        } catch (FileNotFoundException e) {
            //swallow
        }
    }
Given a style name, return what tag should be used, and
what style should be applied to it.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/WordExtractor.java