Re: tidy - ? html tree number

Chunbo Shao wrote:
> Many many thanks to your kind help. I attach my files to you. Actually, i
> just use the example java file TestDOM class in "jtidy.html" which is from
> the tidy package. My html file is out0.html. "resu" is the output by
> running "java TestDOM out0.html > resu". Please see the "resu" file and
> "out0.html", the "len" for <html> is 1, not 2. But it should be 2. Because
> it has <head> and <body> in "out0.html". And, the "len" for <head> in
> "resu" is 1, not 3. But it should be 3 because <meta>, <script> and
> <title> are 3 children of <head> in "out0.html".

Okay, Chunbo, I've found the problem.  My clue was the warning messages
received from running TestDOM.  I received the message:

line 10 column 1 - Warning: unexpected </head> in <meta>

This was a hint that something was wrong since </head> seems to be
perfectly okay.  Upon reviewing TestDOM.java, I see the line:

  tidy.setXmlTags(true);

This tells JTidy to treat the input as XML, not as HTML.  If you comment
out this line, then the input will be treated as HTML and everything
will behave as you expect.

HTH,
Gary

Received on Tuesday, 9 January 2001 01:10:19 UTC