Menu

hwo do i do this

Help
Anonymous
2004-03-05
2004-03-07
  • Anonymous

    Anonymous - 2004-03-05

    how to i do this

    input:
    <tr>
      <td>Hello <b>world</b></td>
    </tr>

    expected output
    Hello world

    result of this code
    Hello
    world

    here is snipplet of the code
    TableRow row = tableTag.getRow(i);
                    TableColumn [] columns = row.getColumns ();
                    for (int j=0;j<columns.length;j++)
                    {
                      cells =  ((TableColumn)columns[j]).getChildrenAsNodeArray ();
                      //System.out.println(cells.length);
                      for (int k = 0; k <  cells.length; k++)
                      {
                      if (cells[k] instanceof  StringNode)
                        {
                          System.out.println(StringNode)cells[k]).getText());
                        }
                       }
                      }

     
    • Derrick Oswald

      Derrick Oswald - 2004-03-07

      Maybe:
      for (int k = 0; k < cells.length; k++)
          if (cells[k] instanceof StringNode)
              System.out.print (StringNode)cells[k]).getText());
      System.out.println ();

      If you really want to handle text like a browser does, you can use the StringBean.  I think it handles tables in the order you want.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.