public static boolean renderHeader(HitGroup hit, XMLWriter writer) throws IOException {
        if (hit instanceof GroupList) {
            writer.openTag(TAG_GROUP_LIST).attribute(ATR_LABEL, ((GroupList)hit).getLabel());
            renderContinuations(((GroupList)hit).continuations(), writer);
        } else if (hit instanceof Group) {
            writer.openTag(TAG_GROUP).attribute(ATR_RELEVANCE, hit.getRelevance().toString());
            renderGroupId(((Group)hit).getGroupId(), writer);
            if (hit instanceof RootGroup) {
                renderContinuation(Continuation.THIS_PAGE, ((RootGroup)hit).continuation(), writer);
            }
            hit.forEachField((name, value) -> writer.openTag(TAG_OUTPUT).attribute(ATR_LABEL, name).content(value, false).closeTag());
        } else if (hit instanceof HitList) {
            writer.openTag(TAG_HIT_LIST).attribute(ATR_LABEL, ((HitList)hit).getLabel());
            renderContinuations(((HitList)hit).continuations(), writer);
        } else {
            return false;
        }
        writer.closeStartTag();
        return true;
    }
Renders the header for the given grouping hit. If the hit is not a grouping hit, this method does nothing and
returns false.
<p>Post-condition if this is a grouping hit: The hit tag is open.

@param hit    The hit whose header to render.
@param writer The writer to render to.
@return True if the hit was rendered.
@throws IOException Thrown if there was a problem writing.
container-search/src/main/java/com/yahoo/search/grouping/result/HitRenderer.java