[ZPT] HELP XML , ZPT ESCAPE SEQUENCE FOR '<'

Chris Withers lists at simplistix.co.uk
Mon Apr 5 06:55:20 EDT 2004


jprakash13 at netscape.net wrote:

> whenever i test this page text/xml zpt page an RSS feed
>  ----
>      <item tal:repeat="item options/feature">
>     <postdate tal:content="item/post_date"> Date Comes here </postdate>
>     <head tal:replace="python:here.removeHtml('<text')">Head Comes here</head>
> 
> ---
> 
> removeHtml python script takes "<text" and removes any symbols < and > , but even before this script is called , when i test the above page it throws this error

Removing HTML is a lot more complex than that ;-) try stripogram's html2safehtml 
  function.

> Only one top level element is allowed in an XML document. Error processing resource 'http://stage.ebizq.net/newsite/prakashtest/rssfeed'. Line 3, Position 6 

this is a pretty explicit error message.

The snippet abvoe doesn't have a single root element as required for XML, as 
stated in the error message...

try:
<root>
  <item tal:repeat="item options/feature">
  <postdate tal:content="item/post_date"> Date Comes here </postdate>
  <head tal:replace="python:here.removeHtml('<text')">Head Comes here</head>
  </item>
</root>

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




More information about the ZPT mailing list