thead not at the top of a table goes missing

View: New views
3 Messages — Rating Filter:   Alert me  

thead not at the top of a table goes missing

by dubium :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The attached code will produce the following output on the following two
simple html tables. Note in the second table, the "6|Banana" row is
missing. Any ideas?


---------------------------

6|Banana|
5|Bicycle|
3|John|

5|Bicycle|
3|John|



----------

<html><head><body>
<table id="table1">

<thead>
<tr>
<td>6</td>
<td>Banana</td>
</tr>
</thead>

<tr>
<td>5</td>
<td>Bicycle</td>
</tr>

<tr>
<td>3</td>
<td>John</td>
</tr>

</table>


<table id="table2">

<tr>
<td>5</td>
<td>Bicycle</td>
</tr>

<thead>
<tr>
<td>6</td>
<td>Banana</td>
</tr>
</thead>

<tr>
<td>3</td>
<td>John</td>
</tr>

</table>
</body></html>










-------------------------------


import java.util.ArrayList;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTable;
import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
import com.gargoylesoftware.htmlunit.html.HtmlTableRow;

public class HtmlTableBug {

   public static void main( String args[] )
       throws Exception
   {
       final WebClient webClient = new WebClient();
       final HtmlPage page = webClient.getPage( "file:///test.html" );

       final ArrayList<HtmlElement> tables = new ArrayList<HtmlElement>(
page.getElementsByTagName("table") );
       for( final HtmlElement tableElement : tables ) {
           ArrayList<HtmlTableRow> allRows = new ArrayList<HtmlTableRow>(
((HtmlTable)tableElement).getRows() );
           for( final HtmlTableRow row : allRows ) {
               for( final HtmlTableCell cell : row.getCells() ) {
                       System.out.print( cell.asText() + "|" );
               }
               System.out.println();
           }
           System.out.println();
       }
   }
}

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: thead not at the top of a table goes missing

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey John,

It looks like a bug to me, but I haven't really investigated. You've filed a bug for this, right?

Take care,

Daniel



On Mon, Oct 26, 2009 at 6:30 PM, John Smith <dubium1@...> wrote:
The attached code will produce the following output on the following two
simple html tables. Note in the second table, the "6|Banana" row is
missing. Any ideas?


---------------------------

6|Banana|
5|Bicycle|
3|John|

5|Bicycle|
3|John|



----------

<html><head><body>
<table id="table1">

<thead>
<tr>
<td>6</td>
<td>Banana</td>
</tr>
</thead>

<tr>
<td>5</td>
<td>Bicycle</td>
</tr>

<tr>
<td>3</td>
<td>John</td>
</tr>

</table>


<table id="table2">

<tr>
<td>5</td>
<td>Bicycle</td>
</tr>

<thead>
<tr>
<td>6</td>
<td>Banana</td>
</tr>
</thead>

<tr>
<td>3</td>
<td>John</td>
</tr>

</table>
</body></html>










-------------------------------


import java.util.ArrayList;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTable;
import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
import com.gargoylesoftware.htmlunit.html.HtmlTableRow;

public class HtmlTableBug {

  public static void main( String args[] )
      throws Exception
  {
      final WebClient webClient = new WebClient();
      final HtmlPage page = webClient.getPage( "file:///test.html" );

      final ArrayList<HtmlElement> tables = new ArrayList<HtmlElement>(
page.getElementsByTagName("table") );
      for( final HtmlElement tableElement : tables ) {
          ArrayList<HtmlTableRow> allRows = new ArrayList<HtmlTableRow>(
((HtmlTable)tableElement).getRows() );
          for( final HtmlTableRow row : allRows ) {
              for( final HtmlTableCell cell : row.getCells() ) {
                      System.out.print( cell.asText() + "|" );
              }
              System.out.println();
          }
          System.out.println();
      }
  }
}

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user



--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: thead not at the top of a table goes missing

by dubium :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Agreed, and yeah, I did file a bug report.

Thanks for having a look.


gredler wrote:
Hey John,

It looks like a bug to me, but I haven't really investigated. You've filed a
bug for this, right?

Take care,

Daniel



On Mon, Oct 26, 2009 at 6:30 PM, John Smith <dubium1@gmail.com> wrote:

> The attached code will produce the following output on the following two
> simple html tables. Note in the second table, the "6|Banana" row is
> missing. Any ideas?
>
>
> ---------------------------
>
> 6|Banana|
> 5|Bicycle|
> 3|John|
>
> 5|Bicycle|
> 3|John|
>
>
>
> ----------
>
> <html><head><body>
> <table id="table1">
>
> <thead>
> <tr>
> <td>6</td>
> <td>Banana</td>
> </tr>
> </thead>
>
> <tr>
> <td>5</td>
> <td>Bicycle</td>
> </tr>
>
> <tr>
> <td>3</td>
> <td>John</td>
> </tr>
>
> </table>
>
>
> <table id="table2">
>
> <tr>
> <td>5</td>
> <td>Bicycle</td>
> </tr>
>
> <thead>
> <tr>
> <td>6</td>
> <td>Banana</td>
> </tr>
> </thead>
>
> <tr>
> <td>3</td>
> <td>John</td>
> </tr>
>
> </table>
> </body></html>
>
>
>
>
>
>
>
>
>
>
> -------------------------------
>
>
> import java.util.ArrayList;
>
> import com.gargoylesoftware.htmlunit.WebClient;
> import com.gargoylesoftware.htmlunit.html.HtmlElement;
> import com.gargoylesoftware.htmlunit.html.HtmlPage;
> import com.gargoylesoftware.htmlunit.html.HtmlTable;
> import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
> import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
>
> public class HtmlTableBug {
>
>   public static void main( String args[] )
>       throws Exception
>   {
>       final WebClient webClient = new WebClient();
>       final HtmlPage page = webClient.getPage( "file:///test.html" );
>
>       final ArrayList<HtmlElement> tables = new ArrayList<HtmlElement>(
> page.getElementsByTagName("table") );
>       for( final HtmlElement tableElement : tables ) {
>           ArrayList<HtmlTableRow> allRows = new ArrayList<HtmlTableRow>(
> ((HtmlTable)tableElement).getRows() );
>           for( final HtmlTableRow row : allRows ) {
>               for( final HtmlTableCell cell : row.getCells() ) {
>                       System.out.print( cell.asText() + "|" );
>               }
>               System.out.println();
>           }
>           System.out.println();
>       }
>   }
> }
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Htmlunit-user mailing list
> Htmlunit-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>



--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-user