Re: tidy - ? html tree number

Chunbo Shao wrote:
> 
> Dear Sir,
> 
> Great thanks for your kind help.
> 
> When i use TestDom.java, I find the number of the child generated by it is
> not correct in html tree. The actual code is
>          NodeList children = node.getChildNodes();
>          if ( children != null ) {
>             int len = children.getLength();
>             for ( int i = 0; i < len; i++ ) {
>                print(children.item(i));
> 
> Here, it seems that "len" is the number of children, but it is not
> correct. Is this problem solved? how?

Major --

This code works fine for me.  How are you setting the variable "node"? 
In my tests, getLength() seems to return the correct value.  Remember
that the html element is the child of the document node and that the
head and body elements are children of the html element.

If you're unable to figure out what the problem is, please forward your
complete java code, the html page you're using, and the output that
you're receiving along with a note indicating where you think that the
output is wrong.

Gary

Received on Monday, 8 January 2001 13:37:56 UTC