private static ContentTags parseContentAndTags(EvalFilePaths evalFilePaths, Metadata metadata) {
        String s = metadata.get(TikaCoreProperties.TIKA_CONTENT);
        if (s == null || s.isEmpty()) {
            return ContentTags.EMPTY_CONTENT_TAGS;
        }

        String handlerClass = metadata.get(TikaCoreProperties.TIKA_CONTENT_HANDLER);
        if (evalFilePaths
                .getExtractFile()
                .getFileName()
                .toString()
                .toLowerCase(Locale.ENGLISH)
                .endsWith(".html")) {
            try {
                return ContentTagParser.parseHTML(s, UC_TAGS_OF_INTEREST.keySet());
            } catch (IOException | SAXException e) {
                LOG.warn("Problem parsing html in {}; backing off to treat string as text", evalFilePaths
                        .getExtractFile()
                        .toAbsolutePath()
                        .toString(), e);

                return new ContentTags(s, true);
            }
        } else if (evalFilePaths
                .getExtractFile()
                .getFileName()
                .toString()
                .toLowerCase(Locale.ENGLISH)
                .endsWith(".xhtml") || (handlerClass != null && handlerClass.equals(ToXMLContentHandler.class.getSimpleName()))) {
            try {
                return ContentTagParser.parseXML(s, UC_TAGS_OF_INTEREST.keySet());
            } catch (TikaException | IOException | SAXException e) {
                LOG.warn("Problem parsing xhtml in {}; backing off to html parser", evalFilePaths
                        .getExtractFile()
                        .toAbsolutePath()
                        .toString(), e);
                try {
                    ContentTags contentTags = ContentTagParser.parseHTML(s, UC_TAGS_OF_INTEREST.keySet());
                    contentTags.setParseException(true);
                    return contentTags;
                } catch (IOException | SAXException e2) {
                    LOG.warn("Problem parsing html in {}; backing off to treat string as text", evalFilePaths
                            .getExtractFile()
                            .toAbsolutePath()
                            .toString(), e2);
                }
                return new ContentTags(s, true);
            }
        }
        return new ContentTags(s);
    }
@param list
@return empty list if input list is empty or null
tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/AbstractProfiler.java