private void output(String what) throws SAXException {
            String text = null;
            if (pageCount == 1 && defaultFirst != null) {
                text = defaultFirst;
            } else if (pageCount % 2 == 0 && defaultEven != null) {
                text = defaultEven;
            } else {
                text = defaultOdd;
            }

            if (text != null) {
                xhtml.startElement("div", "class", "header");
                xhtml.characters(text);
                if (hasAutoPageNumber) {
                    if (autoPageNumberFormat == null) { // raw number
                        xhtml.characters("\t" + pageCount);
                    } else if (autoPageNumberFormat.equals("upper-roman")) {
                        xhtml.characters("\t" + AutoPageNumberUtils.asRomanNumerals(pageCount));
                    } else if (autoPageNumberFormat.equals("lower-roman")) {
                        xhtml.characters(
                                "\t" + AutoPageNumberUtils.asRomanNumeralsLower(pageCount));
                    } else if (autoPageNumberFormat.equals("upper-alpha")) {
                        xhtml.characters("\t" + AutoPageNumberUtils.asAlphaNumeric(pageCount));
                    } else if (autoPageNumberFormat.equals("lower-alpha")) {
                        xhtml.characters("\t" + AutoPageNumberUtils.asAlphaNumericLower(pageCount));
                    }
                }
                xhtml.endElement("div");
            }
        }
Represents the Headers or Footers in a document
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-apple-module/src/main/java/org/apache/tika/parser/iwork/PagesContentHandler.java