Make sure your templates are valid XML

by Plone Documentation Team last modified Sep 23, 2010 02:19 PM
It's always been "best practice" to make sure your templates validate, even though it's not required. With Plone 4, there are even more benefits to doing so.

It's long been considered "best practice" to make sure that all of the templates in your custom products validate as valid XML.  But, since web browsers are so forgiving of sloppy markup, it has also been the case that there have been few strong incentives to make sure your XML is perfectly valid.  Until now.

By using Chameleon, a drop-in replacement for Zope's ZPT template rendering engine, a Plone 4 site can immediate experience 25-50% improvements in performance.  However, Chameleon absolutely requires that all page templates be valid XML.

Plone 4 does not include Chameleon, although it can be added as an add-on product.  Current plans call for Plone 5 to use Chameleon by default, and it may start shipping (disabled) with a future release in the Plone 4.x series (as of this writing, possibly Plone 4.2).   Bottom line: as you're updating your add-on products for Plone 4, now is the perfect time to double-check your templates to make sure they're well-formed XML.

The simplest way to validate your templates is probably to use xmllint.  You can also use the W3C validator, either online or on your Mac OS X system.