code: public static boolean validateTableRow(final Node row, final int numColumns) {
          assert row != null;
          assert row.getNodeName().equals("row") || row.getNodeName().equals("tr");
  
          if (row.getNodeName().equals("row")) {
              final List<Node> entries = XMLUtilities.getDirectChildNodes(row, "entry");
              final List<Node> entryTbls = XMLUtilities.getDirectChildNodes(row, "entrytbl");
  
              if ((entries.size() + entryTbls.size()) <= numColumns) {
                  for (final Node entryTbl : entryTbls) {
                      if (!validateEntryTbl((Element) entryTbl)) return false;
                  }
                  return true;
              } else {
                  return false;
              }
          } else {
              final List<Node> nodes = XMLUtilities.getDirectChildNodes(row, "td", "th");
  
              return nodes.size() <= numColumns;
          }
      }
docs: Check to ensure that a docbook row has the required number of columns for a table.
  
  @param row        The DOM row element to be checked.
  @param numColumns The number of entry elements that should exist in the row.
  @return True if the row has the required number of entries, otherwise false.