private static String getHeaderText(final @Nullable XmlTag header) {
    if (header == null) return null;

    final StringBuilder buf = new StringBuilder();

    if (HGROUP_ELEMENT.equalsIgnoreCase(header.getLocalName())) {
      for (XmlTag subTag : header.getSubTags()) {
        if (ArrayUtil.contains(StringUtil.toLowerCase(subTag.getLocalName()), HEADER_ELEMENTS)) {
          if (buf.length() > 0) {
            buf.append(" ");
          }
          appendTextRecursively(subTag, buf, HtmlTagTreeElement.MAX_TEXT_LENGTH * 2);
        }
      }
    }
    else {
      appendTextRecursively(header, buf, HtmlTagTreeElement.MAX_TEXT_LENGTH * 2);
    }

    return buf.toString();
  }
private static String getHeaderText(final @Nullable XmlTag header)