W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 1999

Re: Traversing tree nodes

From: Andy Quick <ac.quick@sympatico.ca>
Date: Wed, 6 Oct 1999 23:43:53 -0400
Message-ID: <001301bf1076$586a2580$9efbacce@quick>
To: <html-tidy@w3.org>
> I am having difficulty traversing the tree tidy.parse() generates. I want
to
> skip contents of some elements. I have used
> "content" and "next" variables of the Node object to traverse the tree.
But
> they haven't been very useful when skipping contents. Here is an example:

I suggest that you get the latest Java tidy with DOM interfaces.
The method names such as 'getChildNodes' make the relationships
more clear.  The Java tidy web page has an updated sample that uses
the DOM interfaces, as returned by parseDOM().

In the following HTML file (with missing end tags added) the embedded
table will be a child of one of the td elements:

<html>
<head>
</head>
<body>
<table>
<thead>
<tr><td>table 1 - header info.
</td></tr>
</thead>
<tfoot>
<tr><td>table 1 - footer info.
</td></tr>
</tfoot>
<tbody>
<tr><td>
<table><thead><tr><td></td></tr>
</thead><tfoot><tr><td></td></tr></tfoot><tbody><tr><td>Skip
this table</td></tr></tbody></table>
</td></tr>
<tr><td>Skip embedded table to this row.
</td></tr>
</tbody>
</table>
</body>
</html>


Andy Quick
Received on Wednesday, 6 October 1999 23:45:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:42 GMT