W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2001

Re: tidy - ? html tree number

From: Gary L Peskin <garyp@firstech.com>
Date: Mon, 08 Jan 2001 10:36:35 -0800
Message-ID: <3A5A08B3.875D1B60@firstech.com>
To: Chunbo Shao <cxs0187@omega.uta.edu>
CC: html-tidy@w3.org
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.

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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:49 UTC