[ZPT] ExpatError in FS-View but not in ZopeFolder

Fred Drake fdrake at gmail.com
Mon Oct 25 14:46:28 EDT 2004


On 22 Oct 2004 22:12:34 +0200, Christian Ledermann <lists at futuresign.de> wrote:
> A Pagetemplate that is placed in a _Filesystem Directory View_ gives the
> error:
> 
> <!-- Page Template Diagnostics
>  Compilation failed
>  xml.parsers.expat.ExpatError: junk after document element: line 8, column 0
> -->
...
> If I just copy the code (with cut and paste) to a _new_ PageTemplate in a Zope Folder
> everthing works fine, no errors.

This is strange.  I'd expect this to fail in the copy as well.

> My first thought was that there was an illegal char that did not display somewhere,
> but this was not the case, the only invisible chars are LineFeeds.

That's not it.

> the code of the page template is:
> -----------------
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <!DOCTYPE xbel
>   PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML"
>          "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">
> <metal:block tal:define="dummy python:request.RESPONSE.setHeader('Content-Type', 'text/xml')"/>
> 
> <xbel version="1.0"  tal:define="rootLevel

This is not well-formed XML, so Expat is right to raise an exception. 
XML only allows a single top-level element.

You can avoid this problem by moving your tal:define to the xbel element.


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation


More information about the ZPT mailing list