private static Pair<TableCell, TableRow> getTableCell(List<Pair<Boolean, List<Integer>>> tree, List<XmlTag> tags, int index, XmlTag tag, TableRow lastLevel, List<TableRow> table) {
    TableCell answer = null;
    XmlTag element = tags.get(index);
    if (TR.equals(StringUtil.toLowerCase(element.getLocalName()))) {
      TableRow currentLevel = new TableRow(element, tree.get(index).first.booleanValue());
      Pair<Integer, TableCell> tmp = getTableCell(tree, tags, index, tag, 0, table.size(), currentLevel, lastLevel);
      table.add(currentLevel);
      if (tmp.second != null) {
        answer = tmp.second;
      }
      for (int i = currentLevel.size(); i < lastLevel.size(); i++) {
        currentLevel.add(lastLevel.get(i));
      }
      lastLevel = currentLevel;
    }
    for (int child : tree.get(index).second) {
      Pair <TableCell, TableRow> tmp = getTableCell(tree, tags, child, tag, lastLevel, table);
      if (tmp.first != null) {
        answer = tmp.first;
      }
      lastLevel = tmp.second;
    }
    return Pair.create(answer, lastLevel);
  }
private static Pair<TableCell, TableRow> getTableCell(List<Pair<Boolean, List<Integer>>> tree, List<XmlTag> tags, int index, XmlTag tag, TableRow lastLevel, List<TableRow> table)