// generate the entire table.
sectionTag = sectionTag.toLowerCase();
String innerHtml = "<table><" + sectionTag + ">" + rowHtml + "</"
+ sectionTag + "></table>";
tmpElem.setInnerHTML(innerHtml);
TableElement tableElem = tmpElem.getFirstChildElement().cast();
// Detach the event listener.
DOM.setEventListener(tmpElem, null);
// Get the section out of the table.
if ("tbody".equals(sectionTag)) {
return tableElem.getTBodies().getItem(0);
} else if ("thead".equals(sectionTag)) {
return tableElem.getTHead();
} else if ("tfoot".equals(sectionTag)) {
return tableElem.getTFoot();
}
throw new IllegalArgumentException(
"Invalid table section tag: " + sectionTag);
}