[ZPT] Why does this cause a page template to be invalid? (longish)

Fred L. Drake, Jr. fdrake@acm.org
Fri, 22 Mar 2002 09:58:51 -0500


Godefroid Chapelle writes:
 > You are right : validation is not the correct word. But how would you state 
 > that the ZPT does check that you do not enclose block elements in inline 
 > elements ?

It depends on whether you're working with XHTML or HTML.  The
HTML/XHTML parser is ensuring that it can work with HTML as well, and
is checking the block/inline nature of the tags in order to understand
the structure of the page correctly; it needs to determine when
elements would be closed by an SGML parser using the HTML DTD.  This
is needed so that block elements don't appear logically in inline
content:

<p> some text...
<h2> heading... </h2>

should be interpreted as

<p> some text... </p>
<h2> heading... </h2>

rather than

<p> some text...
<h2> heading... </h2>
</p>

 > I think well-formedness is weaker. Just checking the correct form of 
 > elements; attributes and so on ?

That's correct.  If you simply want XML well-formedness, and can
ensure reasonable structure some other way (such as by using a
validator), and really are using XML, you should be able to use the
XML version of the parser; get that from the TALParser module instead
of from the HTMLTALParser module.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation