code: public static boolean validateTableGroup(final Element tgroup) {
          assert tgroup != null;
          assert tgroup.getNodeName().equals("tgroup");
  
          final Integer numColumns = Integer.parseInt(tgroup.getAttribute("cols"));
  
          // Check that all the thead, tbody and tfoot elements have the correct number of entries.
          final List<Node> nodes = XMLUtilities.getDirectChildNodes(tgroup, "thead", "tbody", "tfoot");
          for (final Node ele : nodes) {
              // Find all child nodes that are a row
              final NodeList children = ele.getChildNodes();
              for (int i = 0; i < children.getLength(); i++) {
                  final Node node = children.item(i);
                  if (node.getNodeName().equals("row") || node.getNodeName().equals("tr")) {
                      if (!validateTableRow(node, numColumns)) return false;
                  }
              }
          }
  
          return true;
      }
docs: Check to ensure that a Docbook tgroup isn't missing an row entries, using number of cols defined for the tgroup.
  
  @param tgroup The DOM tgroup element to be checked.
  @return True if the tgroup has the required number of entries, otherwise false.