Program: 36982
Project: 36982
Buggy source:
public Table processMultiTable(Cell[][] cells,Table table,Article art,String tableFileName){
  if (table.getTableStructureType() != Table.StructureType.MULTI && table.getTableStructureType() != null) {
    return table;
  }
  Statistics.addMultiTable();
  table.setTableStructureType(Table.StructureType.MULTI);
  if (TablInExMain.ExportLinkedData) {
    TablInExMain.linkedData.AddTable(table.getTable_title(),table.getTable_caption(),"String_Node_Str","String_Node_Str",table.getTable_footer(),table.getXml());
  }
  if (!table.isHasHeader()) {
    table=checkHeaders(table);
    cells=table.cells;
  }
  cells=markMultiTableHeaders(cells);
  if (cells[0].length > 1) {
    String[] headerStackA=new String[20];
    int currentSubHeaderLevel=0;
    String prevSubheader="String_Node_Str";
    boolean hasSpaceSubheaders=false;
    if (table.isHasHeader() == false) {
      table=checkHeaders(table);
    }
    cells=table.cells;
    boolean firstHeader=true;
    for (int j=0; j < cells.length; j++) {
      if (cells[j][0].isIs_header()) {
        continue;
      }
      boolean emptyLine=true;
      for (int h=0; h < cells[j].length; h++) {
        if (!Utilities.isSpaceOrEmpty(cells[j][h].getCell_content())) {
          emptyLine=false;
          break;
        }
      }
      if (emptyLine)       continue;
      if (cells[j][0].isIs_columnspanning() && table.getNum_of_columns() > 1 && cells[j][0].getCells_columnspanning() >= table.getNum_of_columns()) {
        if (Utilities.numOfBegeningSpaces(cells[j][0].getCell_content()) == currentSubHeaderLevel)         headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
 else {
          currentSubHeaderLevel=Utilities.numOfBegeningSpaces(cells[j][0].getCell_content());
          headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
        }
        SetSubheaderRow(cells[j]);
        continue;
      }
      boolean emptyCells=true;
      for (int h=1; h < cells[j].length; h++) {
        if (cells[j][h].getCell_content() == null) {
          cells[j][h].setCell_content("String_Node_Str");
        }
        if (Utilities.isSpaceOrEmpty(cells[j][0].getCell_content()) || !Utilities.isSpaceOrEmpty(cells[j][h].getCell_content())) {
          emptyCells=false;
        }
      }
      if (emptyCells) {
        if (currentSubHeaderLevel != 0 && currentSubHeaderLevel == j - 1) {
          if (Utilities.numOfBegeningSpaces(cells[j][0].getCell_content()) == currentSubHeaderLevel) {
            headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
            SetSubheaderRow(cells[j]);
          }
 else {
            currentSubHeaderLevel=Utilities.numOfBegeningSpaces(cells[j][0].getCell_content());
            headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
            SetSubheaderRow(cells[j]);
          }
        }
 else {
          if (Utilities.numOfBegeningSpaces(cells[j][0].getCell_content()) == currentSubHeaderLevel) {
            headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
            SetSubheaderRow(cells[j]);
          }
 else {
            currentSubHeaderLevel=Utilities.numOfBegeningSpaces(cells[j][0].getCell_content());
            headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
            SetSubheaderRow(cells[j]);
          }
          if (j > 0 && isRowSubheader(cells[j - 1],table)) {
            prevSubheader=cells[j - 1][0].getCell_content();
          }
          continue;
        }
      }
      if (isRowSubheader(cells[j],table)) {
        if (j > 0 && isRowSubheader(cells[j - 1],table)) {
          prevSubheader=cells[j - 1][0].getCell_content();
        }
        continue;
      }
      if (cells[j][0].getCell_content() == null) {
        cells[j][0].setCell_content("String_Node_Str");
      }
      if ((cells != null && cells[j] != null && cells[j][0] != null && cells[j][0].getCell_content() != null) && (cells[j][0].getCell_content().length() > 0 && Utilities.isSpace(cells[j][0].getCell_content().trim().charAt(0))) || Utilities.isSpaceOrEmpty(cells[j][0].getCell_content())) {
        hasSpaceSubheaders=true;
        SetSubheaderRow(cells[j]);
        if (Utilities.numOfBegeningSpaces(cells[j][0].getCell_content()) == currentSubHeaderLevel || Utilities.isSpaceOrEmpty(cells[j][0].getCell_content()))         headerStackA[currentSubHeaderLevel]=cells[j][0].getCell_content();
 else {
          currentSubHeaderLevel=Utilities.numOfBegeningSpaces(cells[j][0].getCell_content());
          headerStackA[currentSubHeaderLevel]=cells[j][0].getCell_content();
        }
      }
 else {
        if (hasSpaceSubheaders)         currentSubHeaderLevel=0;
        headerStackA[currentSubHeaderLevel]=cells[j][0].getCell_content();
      }
      for (int k=1; k < cells[j].length; k++) {
        try {
          DocumentBuilderFactory docFactory=DocumentBuilderFactory.newInstance();
          DocumentBuilder docBuilder=docFactory.newDocumentBuilder();
          Document doc=docBuilder.newDocument();
          Element rootElement=doc.createElement("String_Node_Str");
          doc.appendChild(rootElement);
          Element cell=doc.createElement("String_Node_Str");
          rootElement.appendChild(cell);
          Element NavigationPath=doc.createElement("String_Node_Str");
          String Head00Str="String_Node_Str";
          if (!Utilities.isSpaceOrEmpty(cells[0][0].getCell_content()) && cells[0][0].isIs_header()) {
            boolean foundHeader=false;
            for (int l=j; l >= 0; l--) {
              if (cells[l][k].isIs_header()) {
                if (!cells[l][k].getCell_content().equals("String_Node_Str"))                 Head00Str=cells[l][k].getCell_content();
                foundHeader=true;
              }
              if (foundHeader && !cells[l][k].isIs_header()) {
                break;
              }
            }
            Element Head00=doc.createElement("String_Node_Str");
            Head00.setTextContent(Head00Str);
            cells[j][k].setHead00(Head00Str);
            NavigationPath.appendChild(Head00);
          }
          Element Stub=doc.createElement("String_Node_Str");
          if (currentSubHeaderLevel > 0) {
            getStackAsElements(headerStackA,prevSubheader,currentSubHeaderLevel,doc,Stub);
          }
          String subheaderValues="String_Node_Str";
          String[] SubHeaders=new String[Stub.getChildNodes().getLength()];
          for (int l=0; l < Stub.getChildNodes().getLength(); l++) {
            subheaderValues+="String_Node_Str" + Stub.getChildNodes().item(l).getTextContent();
            SubHeaders[l]=Stub.getChildNodes().item(l).getTextContent();
          }
          cells[j][k].setSubheader_values(subheaderValues);
          Element ss=doc.createElement("String_Node_Str");
          ss.setTextContent(cells[j][0].getCell_content());
          cells[j][k].setStub_values(cells[j][0].getCell_content());
          Stub.appendChild(ss);
          NavigationPath.appendChild(Stub);
          LinkedList<String> headers=new LinkedList<String>();
          boolean foundHeader=false;
          for (int l=j; l >= 0; l--) {
            if (cells[l][k].isIs_header()) {
              if (!cells[l][k].getCell_content().equals("String_Node_Str"))               headers.addFirst(cells[l][k].getCell_content());
              foundHeader=true;
            }
            if (foundHeader && !cells[l][k].isIs_header()) {
              break;
            }
          }
          for (int s=0; s < headers.size(); s++) {
            Element Header=doc.createElement("String_Node_Str" + s);
            Header.setTextContent(headers.get(s));
            cells[j][k].setHeader_values(headers.toString());
            NavigationPath.appendChild(Header);
          }
          cell.appendChild(NavigationPath);
          Element info=doc.createElement("String_Node_Str");
          info.setTextContent(cells[j][k].getCell_content());
          cell.appendChild(info);
          Element CellType=doc.createElement("String_Node_Str");
          CellType.setTextContent(cells[j][k].getCellType());
          cell.appendChild(CellType);
          Element tableEl=doc.createElement("String_Node_Str");
          rootElement.appendChild(tableEl);
          Element tname=doc.createElement("String_Node_Str");
          tname.setTextContent(table.getTable_caption());
          tableEl.appendChild(tname);
          Element TableType=doc.createElement("String_Node_Str");
          TableType.setTextContent("String_Node_Str");
          tableEl.appendChild(TableType);
          Element torder=doc.createElement("String_Node_Str");
          torder.setTextContent(table.getTable_title());
          tableEl.appendChild(torder);
          Element tfooter=doc.createElement("String_Node_Str");
          tfooter.setTextContent(table.getTable_footer());
          tableEl.appendChild(tfooter);
          Element document=doc.createElement("String_Node_Str");
          rootElement.appendChild(document);
          Element docTitle=doc.createElement("String_Node_Str");
          docTitle.setTextContent(art.getTitle());
          document.appendChild(docTitle);
          Element pmc=doc.createElement("String_Node_Str");
          pmc.setTextContent(art.getPmc());
          document.appendChild(pmc);
          if (TablInExMain.ExportLinkedData) {
            TablInExMain.linkedData.AddCell(cells[j][0].getCell_content(),SubHeaders,cells[j][k].getCell_content(),cells[j][k].getCellType(),cells[0][k].headers.toArray(new String[0]),cells[0][0].getCell_content(),j,k);
          }
          DataExtractionOutputObj dataExtObj=new DataExtractionOutputObj(folder + tableFileName + "String_Node_Str"+ j+ "String_Node_Str"+ k+ "String_Node_Str",doc);
          table.output.add(dataExtObj);
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
    }
  }
 else {
    boolean hasSubheaders=hasSuperRowsListTable(cells,table);
    boolean TopLevel=false;
    String currentSubHeader="String_Node_Str";
    for (int j=0; j < cells.length; j++) {
      for (int k=0; k < cells[j].length; k++) {
        if (cells[j][k].isIs_header())         continue;
        try {
          if (hasSubheaders) {
            if (TopLevel == false && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && cells[j + 1] != null && Utilities.numOfSpaceOrBullets(cells[j + 1][k].getCell_content()) != 0 && currentSubHeader.equals("String_Node_Str")) {
              TopLevel=true;
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
            if (TopLevel == false && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && (cells[j + 2] != null && Utilities.numOfSpaceOrBullets(cells[j + 2][k].getCell_content()) != 0) && currentSubHeader.equals("String_Node_Str")) {
              TopLevel=true;
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
            if (TopLevel == true && !cells[j][k].isBreakingLineOverRow() && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && !currentSubHeader.equals("String_Node_Str")) {
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
          }
          DocumentBuilderFactory docFactory=DocumentBuilderFactory.newInstance();
          DocumentBuilder docBuilder=docFactory.newDocumentBuilder();
          Document doc=docBuilder.newDocument();
          Element rootElement=doc.createElement("String_Node_Str");
          doc.appendChild(rootElement);
          Element cell=doc.createElement("String_Node_Str");
          rootElement.appendChild(cell);
          Element NavigationPath=doc.createElement("String_Node_Str");
          LinkedList<String> headers=new LinkedList<String>();
          boolean foundHeader=false;
          for (int l=j; l >= 0; l--) {
            if (cells[l][k].isIs_header()) {
              if (!cells[l][k].getCell_content().equals("String_Node_Str"))               headers.addFirst(cells[l][k].getCell_content());
              foundHeader=true;
            }
            if (foundHeader && !cells[l][k].isIs_header()) {
              break;
            }
          }
          for (int s=0; s < headers.size(); s++) {
            Element Header=doc.createElement("String_Node_Str" + s);
            Header.setTextContent(headers.get(s));
            cells[j][k].setHeader_values(headers.toString());
            NavigationPath.appendChild(Header);
          }
          if (currentSubHeader != "String_Node_Str") {
            Element SubHeader=doc.createElement("String_Node_Str");
            SubHeader.setTextContent(currentSubHeader);
            NavigationPath.appendChild(SubHeader);
          }
          cell.appendChild(NavigationPath);
          cells[j][k].setHeader_values(cells[0][k].getCell_content());
          Element info=doc.createElement("String_Node_Str");
          info.setTextContent(cells[j][k].getCell_content());
          cell.appendChild(info);
          Element CellType=doc.createElement("String_Node_Str");
          CellType.setTextContent(cells[j][k].getCellType());
          cell.appendChild(CellType);
          Element tableA=doc.createElement("String_Node_Str");
          rootElement.appendChild(tableA);
          Element tname=doc.createElement("String_Node_Str");
          tname.setTextContent(table.getTable_caption());
          tableA.appendChild(tname);
          Element TableType=doc.createElement("String_Node_Str");
          TableType.setTextContent("String_Node_Str");
          tableA.appendChild(TableType);
          Element torder=doc.createElement("String_Node_Str");
          torder.setTextContent(table.getTable_title());
          tableA.appendChild(torder);
          Element tfooter=doc.createElement("String_Node_Str");
          tfooter.setTextContent(table.getTable_footer());
          tableA.appendChild(tfooter);
          Element document=doc.createElement("String_Node_Str");
          rootElement.appendChild(document);
          Element docTitle=doc.createElement("String_Node_Str");
          docTitle.setTextContent(art.getTitle());
          document.appendChild(docTitle);
          Element pmc=doc.createElement("String_Node_Str");
          pmc.setTextContent(art.getPmc());
          document.appendChild(pmc);
          if (TablInExMain.ExportLinkedData) {
            TablInExMain.linkedData.AddCell("String_Node_Str",null,cells[j][k].getCell_content(),cells[j][k].getCellType(),cells[0][k].headers.toArray(new String[0]),"String_Node_Str",j,k);
          }
          DataExtractionOutputObj dataExtObj=new DataExtractionOutputObj(folder + tableFileName + "String_Node_Str"+ j+ "String_Node_Str"+ k+ "String_Node_Str",doc);
          table.output.add(dataExtObj);
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
    }
  }
  table.cells=cells;
  return table;
}

Fixed version (ground truth):
public Table processMultiTable(Cell[][] cells,Table table,Article art,String tableFileName){
  if (table.getTableStructureType() != Table.StructureType.MULTI && table.getTableStructureType() != null) {
    return table;
  }
  Statistics.addMultiTable();
  table.setTableStructureType(Table.StructureType.MULTI);
  if (TablInExMain.ExportLinkedData) {
    TablInExMain.linkedData.AddTable(table.getTable_title(),table.getTable_caption(),"String_Node_Str","String_Node_Str",table.getTable_footer(),table.getXml());
  }
  if (!table.isHasHeader()) {
    table=checkHeaders(table);
    cells=table.cells;
  }
  cells=markMultiTableHeaders(cells);
  if (cells[0].length > 1) {
    String[] headerStackA=new String[20];
    int currentSubHeaderLevel=0;
    String prevSubheader="String_Node_Str";
    boolean hasSpaceSubheaders=false;
    if (table.isHasHeader() == false) {
      table=checkHeaders(table);
    }
    cells=table.cells;
    boolean firstHeader=true;
    for (int j=0; j < cells.length; j++) {
      if (cells[j][0].isIs_header()) {
        continue;
      }
      boolean emptyLine=true;
      for (int h=0; h < cells[j].length; h++) {
        if (!Utilities.isSpaceOrEmpty(cells[j][h].getCell_content())) {
          emptyLine=false;
          break;
        }
      }
      if (emptyLine)       continue;
      if (cells[j][0].isIs_columnspanning() && table.getNum_of_columns() > 1 && cells[j][0].getCells_columnspanning() >= table.getNum_of_columns()) {
        if (Utilities.numOfBegeningSpaces(cells[j][0].getCell_content()) == currentSubHeaderLevel)         headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
 else {
          currentSubHeaderLevel=Utilities.numOfBegeningSpaces(cells[j][0].getCell_content());
          headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
        }
        SetSubheaderRow(cells[j]);
        continue;
      }
      boolean emptyCells=true;
      for (int h=1; h < cells[j].length; h++) {
        if (cells[j][h].getCell_content() == null) {
          cells[j][h].setCell_content("String_Node_Str");
        }
        if (Utilities.isSpaceOrEmpty(cells[j][0].getCell_content()) || !Utilities.isSpaceOrEmpty(cells[j][h].getCell_content())) {
          emptyCells=false;
        }
      }
      if (emptyCells) {
        if (currentSubHeaderLevel != 0 && currentSubHeaderLevel == j - 1) {
          if (Utilities.numOfBegeningSpaces(cells[j][0].getCell_content()) == currentSubHeaderLevel) {
            headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
            SetSubheaderRow(cells[j]);
          }
 else {
            currentSubHeaderLevel=Utilities.numOfBegeningSpaces(cells[j][0].getCell_content());
            headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
            SetSubheaderRow(cells[j]);
          }
        }
 else {
          if (Utilities.numOfBegeningSpaces(cells[j][0].getCell_content()) == currentSubHeaderLevel) {
            headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
            SetSubheaderRow(cells[j]);
          }
 else {
            currentSubHeaderLevel=Utilities.numOfBegeningSpaces(cells[j][0].getCell_content());
            headerStackA[currentSubHeaderLevel++]=cells[j][0].getCell_content();
            SetSubheaderRow(cells[j]);
          }
          if (j > 0 && isRowSubheader(cells[j - 1],table)) {
            prevSubheader=cells[j - 1][0].getCell_content();
          }
          continue;
        }
      }
      if (isRowSubheader(cells[j],table)) {
        if (j > 0 && isRowSubheader(cells[j - 1],table)) {
          prevSubheader=cells[j - 1][0].getCell_content();
        }
        continue;
      }
      if (cells[j][0].getCell_content() == null) {
        cells[j][0].setCell_content("String_Node_Str");
      }
      if ((cells != null && cells[j] != null && cells[j][0] != null && cells[j][0].getCell_content() != null) && (cells[j][0].getCell_content().length() > 0 && Utilities.isSpace(cells[j][0].getCell_content().trim().charAt(0))) || Utilities.isSpaceOrEmpty(cells[j][0].getCell_content())) {
        hasSpaceSubheaders=true;
        SetSubheaderRow(cells[j]);
        if (Utilities.numOfBegeningSpaces(cells[j][0].getCell_content()) == currentSubHeaderLevel || Utilities.isSpaceOrEmpty(cells[j][0].getCell_content()))         headerStackA[currentSubHeaderLevel]=cells[j][0].getCell_content();
 else {
          currentSubHeaderLevel=Utilities.numOfBegeningSpaces(cells[j][0].getCell_content());
          headerStackA[currentSubHeaderLevel]=cells[j][0].getCell_content();
        }
      }
 else {
        if (hasSpaceSubheaders)         currentSubHeaderLevel=0;
        headerStackA[currentSubHeaderLevel]=cells[j][0].getCell_content();
      }
      for (int k=1; k < cells[j].length; k++) {
        try {
          DocumentBuilderFactory docFactory=DocumentBuilderFactory.newInstance();
          DocumentBuilder docBuilder=docFactory.newDocumentBuilder();
          Document doc=docBuilder.newDocument();
          Element rootElement=doc.createElement("String_Node_Str");
          doc.appendChild(rootElement);
          Element cell=doc.createElement("String_Node_Str");
          rootElement.appendChild(cell);
          Element NavigationPath=doc.createElement("String_Node_Str");
          String Head00Str="String_Node_Str";
          if (!Utilities.isSpaceOrEmpty(cells[0][0].getCell_content()) && cells[0][0].isIs_header()) {
            boolean foundHeader=false;
            for (int l=j; l >= 0; l--) {
              if (cells[l][0].isIs_header()) {
                if (!cells[l][0].getCell_content().equals("String_Node_Str"))                 Head00Str=cells[l][0].getCell_content();
                foundHeader=true;
              }
              if (foundHeader && !cells[l][0].isIs_header()) {
                break;
              }
            }
            Element Head00=doc.createElement("String_Node_Str");
            Head00.setTextContent(Head00Str);
            cells[j][k].setHead00(Head00Str);
            NavigationPath.appendChild(Head00);
          }
          Element Stub=doc.createElement("String_Node_Str");
          if (currentSubHeaderLevel > 0) {
            getStackAsElements(headerStackA,prevSubheader,currentSubHeaderLevel,doc,Stub);
          }
          String subheaderValues="String_Node_Str";
          String[] SubHeaders=new String[Stub.getChildNodes().getLength()];
          for (int l=0; l < Stub.getChildNodes().getLength(); l++) {
            subheaderValues+="String_Node_Str" + Stub.getChildNodes().item(l).getTextContent();
            SubHeaders[l]=Stub.getChildNodes().item(l).getTextContent();
          }
          cells[j][k].setSubheader_values(subheaderValues);
          Element ss=doc.createElement("String_Node_Str");
          ss.setTextContent(cells[j][0].getCell_content());
          cells[j][k].setStub_values(cells[j][0].getCell_content());
          Stub.appendChild(ss);
          NavigationPath.appendChild(Stub);
          LinkedList<String> headers=new LinkedList<String>();
          boolean foundHeader=false;
          for (int l=j; l >= 0; l--) {
            if (cells[l][k].isIs_header()) {
              if (!cells[l][k].getCell_content().equals("String_Node_Str"))               headers.addFirst(cells[l][k].getCell_content());
              foundHeader=true;
            }
            if (foundHeader && !cells[l][k].isIs_header()) {
              break;
            }
          }
          for (int s=0; s < headers.size(); s++) {
            Element Header=doc.createElement("String_Node_Str" + s);
            Header.setTextContent(headers.get(s));
            cells[j][k].setHeader_values(headers.toString());
            NavigationPath.appendChild(Header);
          }
          cell.appendChild(NavigationPath);
          Element info=doc.createElement("String_Node_Str");
          info.setTextContent(cells[j][k].getCell_content());
          cell.appendChild(info);
          Element CellType=doc.createElement("String_Node_Str");
          CellType.setTextContent(cells[j][k].getCellType());
          cell.appendChild(CellType);
          Element tableEl=doc.createElement("String_Node_Str");
          rootElement.appendChild(tableEl);
          Element tname=doc.createElement("String_Node_Str");
          tname.setTextContent(table.getTable_caption());
          tableEl.appendChild(tname);
          Element TableType=doc.createElement("String_Node_Str");
          TableType.setTextContent("String_Node_Str");
          tableEl.appendChild(TableType);
          Element torder=doc.createElement("String_Node_Str");
          torder.setTextContent(table.getTable_title());
          tableEl.appendChild(torder);
          Element tfooter=doc.createElement("String_Node_Str");
          tfooter.setTextContent(table.getTable_footer());
          tableEl.appendChild(tfooter);
          Element document=doc.createElement("String_Node_Str");
          rootElement.appendChild(document);
          Element docTitle=doc.createElement("String_Node_Str");
          docTitle.setTextContent(art.getTitle());
          document.appendChild(docTitle);
          Element pmc=doc.createElement("String_Node_Str");
          pmc.setTextContent(art.getPmc());
          document.appendChild(pmc);
          if (TablInExMain.ExportLinkedData) {
            TablInExMain.linkedData.AddCell(cells[j][0].getCell_content(),SubHeaders,cells[j][k].getCell_content(),cells[j][k].getCellType(),cells[0][k].headers.toArray(new String[0]),cells[0][0].getCell_content(),j,k);
          }
          DataExtractionOutputObj dataExtObj=new DataExtractionOutputObj(folder + tableFileName + "String_Node_Str"+ j+ "String_Node_Str"+ k+ "String_Node_Str",doc);
          table.output.add(dataExtObj);
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
    }
  }
 else {
    boolean hasSubheaders=hasSuperRowsListTable(cells,table);
    boolean TopLevel=false;
    String currentSubHeader="String_Node_Str";
    for (int j=0; j < cells.length; j++) {
      for (int k=0; k < cells[j].length; k++) {
        if (cells[j][k].isIs_header())         continue;
        try {
          if (hasSubheaders) {
            if (TopLevel == false && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && cells[j + 1] != null && Utilities.numOfSpaceOrBullets(cells[j + 1][k].getCell_content()) != 0 && currentSubHeader.equals("String_Node_Str")) {
              TopLevel=true;
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
            if (TopLevel == false && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && (cells[j + 2] != null && Utilities.numOfSpaceOrBullets(cells[j + 2][k].getCell_content()) != 0) && currentSubHeader.equals("String_Node_Str")) {
              TopLevel=true;
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
            if (TopLevel == true && !cells[j][k].isBreakingLineOverRow() && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && !currentSubHeader.equals("String_Node_Str")) {
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
          }
          DocumentBuilderFactory docFactory=DocumentBuilderFactory.newInstance();
          DocumentBuilder docBuilder=docFactory.newDocumentBuilder();
          Document doc=docBuilder.newDocument();
          Element rootElement=doc.createElement("String_Node_Str");
          doc.appendChild(rootElement);
          Element cell=doc.createElement("String_Node_Str");
          rootElement.appendChild(cell);
          Element NavigationPath=doc.createElement("String_Node_Str");
          LinkedList<String> headers=new LinkedList<String>();
          boolean foundHeader=false;
          for (int l=j; l >= 0; l--) {
            if (cells[l][k].isIs_header()) {
              if (!cells[l][k].getCell_content().equals("String_Node_Str"))               headers.addFirst(cells[l][k].getCell_content());
              foundHeader=true;
            }
            if (foundHeader && !cells[l][k].isIs_header()) {
              break;
            }
          }
          for (int s=0; s < headers.size(); s++) {
            Element Header=doc.createElement("String_Node_Str" + s);
            Header.setTextContent(headers.get(s));
            cells[j][k].setHeader_values(headers.toString());
            NavigationPath.appendChild(Header);
          }
          if (currentSubHeader != "String_Node_Str") {
            Element SubHeader=doc.createElement("String_Node_Str");
            SubHeader.setTextContent(currentSubHeader);
            NavigationPath.appendChild(SubHeader);
          }
          cell.appendChild(NavigationPath);
          cells[j][k].setHeader_values(cells[0][k].getCell_content());
          Element info=doc.createElement("String_Node_Str");
          info.setTextContent(cells[j][k].getCell_content());
          cell.appendChild(info);
          Element CellType=doc.createElement("String_Node_Str");
          CellType.setTextContent(cells[j][k].getCellType());
          cell.appendChild(CellType);
          Element tableA=doc.createElement("String_Node_Str");
          rootElement.appendChild(tableA);
          Element tname=doc.createElement("String_Node_Str");
          tname.setTextContent(table.getTable_caption());
          tableA.appendChild(tname);
          Element TableType=doc.createElement("String_Node_Str");
          TableType.setTextContent("String_Node_Str");
          tableA.appendChild(TableType);
          Element torder=doc.createElement("String_Node_Str");
          torder.setTextContent(table.getTable_title());
          tableA.appendChild(torder);
          Element tfooter=doc.createElement("String_Node_Str");
          tfooter.setTextContent(table.getTable_footer());
          tableA.appendChild(tfooter);
          Element document=doc.createElement("String_Node_Str");
          rootElement.appendChild(document);
          Element docTitle=doc.createElement("String_Node_Str");
          docTitle.setTextContent(art.getTitle());
          document.appendChild(docTitle);
          Element pmc=doc.createElement("String_Node_Str");
          pmc.setTextContent(art.getPmc());
          document.appendChild(pmc);
          if (TablInExMain.ExportLinkedData) {
            TablInExMain.linkedData.AddCell("String_Node_Str",null,cells[j][k].getCell_content(),cells[j][k].getCellType(),cells[0][k].headers.toArray(new String[0]),"String_Node_Str",j,k);
          }
          DataExtractionOutputObj dataExtObj=new DataExtractionOutputObj(folder + tableFileName + "String_Node_Str"+ j+ "String_Node_Str"+ k+ "String_Node_Str",doc);
          table.output.add(dataExtObj);
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
    }
  }
  table.cells=cells;
  return table;
}