[Zope] too strict html validation in page templates (zpt)

normand cote ncote@sympatico.ca
Wed, 18 Dec 2002 13:01:33 -0500


I find that html validation in page templates is over-strict (at least from
Zope 2.4.3 on).

The following bit validates ok at http://validator.w3.org but fails as input
to a page template ("EOF in middle of construct").  The problem is that the
attributes on the span tag are not separated by whitespace.  It works fine
as a dtml method, though.

The reason this is such a problem is that Dreamweaver MX (and perhaps other
versions) tends to create markup that looks like this, and it is the most
common tool used by page designers with whom I work.

My question is three-fold:
1) Why is there such a difference in syntax sensitivity between zpt and dmtl
methods?
2) Does anyone know of a tweak to tal.htmlparser that will relax some of
these restrictions?
-- OR --
3) Is there a tool that will clean up errant code such as this (and other
problems like p tags not allowing block elements inside them, causing the
htmlparser to choke on the eventual /p that seems to be mismatched.  I know,
there is no certain way to fix such a problem, but just stripping the
mismatched end tag might do.  On second thought, that's not a solution at
all.)

-------------------
Sample html markup that fails as page template source
-------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
		<title>a title</title>
	</head>
	<body>
		<span id="someid"title="description">
		</span>
	</body>
</html>
-------------------