W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2006

Re: Unexpected tag error from Tidy

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Tue, 13 Jun 2006 23:22:23 +0200
To: "Jie Wu" <jie82.wu@gmail.com>
Cc: <html-tidy@w3.org>
Message-ID: <1tau82lbv3eupj7c5mncfn2a7vggcvel19@hive.bjoern.hoehrmann.de>

* Jie Wu wrote:
>
>Hi, All,
>
>Following is part of the HTML code from Google.
>========================================================================
><html>
>	<body bgcolor=#ffffff onload="document.gs.reset();" topmargin=3
>marginheight=3>
>		<table border=0 cellpadding=0 cellspacing=0 width=100%>
>		<tr>
>			<form name="gs" method="GET" action="search">
>				<td>d</td>
>			</form>
>		</tr>
>		</table>
>
>    <br>
>    <br>
>    Your search - <b>ahfljaldfa</b> - did not match any documents.  
>    <br>
>    <br>
>    Suggestions:
>    <ul>
>	    <li>Make sure all words are spelled correctly.
>	    <li>Try different keywords.
>	    <li>Try more general keywords.
>    </ul>
>    <br clear=all>
>  </body>
></html>
>======================================================================
>
>If I use Tidy to convert this HTML to XML, it always says "Error: discarding
>unexpected </form>". However, when I remove the line <td>d</td> away, now it
>could work fine. Is it a bug or something else?

Tidy does not generally know how to correct misplaced <form> or </form>
tags, consider for example

  <table>
    <form ...
      ...
      <input ...
      ...
      <input ...
      ...
    </form>
    <form ...
      ...
      <input ...
      ...
      <input ...
      ...
    </form>
  </table>

If the input elements are in different cells, then there exists no
HTML/XHTML document that represents the same document because you
cannot put <form> into a table like that. In your example, Tidy
might be able to correct the problem (by moving the form out of
the table) but it currently does not. You have to do this by hand.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Tuesday, 13 June 2006 21:22:32 GMT

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