if (!(section instanceof HtmlTableSectionBuilder)) {
throw new IllegalArgumentException("Only HtmlTableSectionBuilder is supported at this time");
}
// Strip the table section tags off of the tbody.
HtmlTableSectionBuilder htmlSection = (HtmlTableSectionBuilder) section;
String rawHtml = htmlSection.asSafeHtml().asString();
assert (tag.length()) == 5 : "Unrecognized tag: " + tag;
assert rawHtml.startsWith("<" + tag + ">") : MALFORMED_HTML_SECTION;
assert rawHtml.endsWith("</" + tag + ">") : MALFORMED_HTML_SECTION;
rawHtml = rawHtml.substring(7, rawHtml.length() - 8);
return SafeHtmlUtils.fromTrustedString(rawHtml);