private void updateStyleTags() throws SAXException {

        if (currTextStyle == null) {
            closeStyleTags();
            return;
        }
        if (currTextStyle.bold != curBold) {
            // Enforce nesting -- must close s and i tags
            if (curUnderlined) {
                handler.endElement(XHTML, "u", "u");
                curUnderlined = false;
            }
            if (curItalic) {
                handler.endElement(XHTML, "i", "i");
                curItalic = false;
            }
            if (currTextStyle.bold) {
                handler.startElement(XHTML, "b", "b", EMPTY_ATTRIBUTES);
            } else {
                handler.endElement(XHTML, "b", "b");
            }
            curBold = currTextStyle.bold;
        }

        if (currTextStyle.italic != curItalic) {
            // Enforce nesting -- must close s tag
            if (curUnderlined) {
                handler.endElement(XHTML, "u", "u");
                curUnderlined = false;
            }
            if (currTextStyle.italic) {
                handler.startElement(XHTML, "i", "i", EMPTY_ATTRIBUTES);
            } else {
                handler.endElement(XHTML, "i", "i");
            }
            curItalic = currTextStyle.italic;
        }

        if (currTextStyle.underlined != curUnderlined) {
            if (currTextStyle.underlined) {
                handler.startElement(XHTML, "u", "u", EMPTY_ATTRIBUTES);
            } else {
                handler.endElement(XHTML, "u", "u");
            }
            curUnderlined = currTextStyle.underlined;
        }
    }
Check if a node is a text node
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/odf/OpenDocumentBodyHandler.java