Re: htmlfill and CDATA
"Jacob Smullyan" <[email protected]>
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
On 10/17/06, Ian Bicking <[email protected]> wrote: > Jacob Smullyan wrote: > > An application of mine using htmlfill recently stopped working because > > the template passing through it has evolved to contain CDATA blocks > > (wrapping the contents of script tags). HTMLParser is the culprit > > here, and I'm not optimistic about its behavior changing. > > What exactly is it doing wrong? HTMLParser seems to choke on any CDATA section, whether in a script tag or elsewhere: s="<html><head><title>CDATA test</title></head><body><p><![CDATA[ this is some cdata. ]]></p></body></html>" p=HP.HTMLParser() res=p.feed(s) # blows up with HTMLParseError This is Python 2.4.3, but I don't think anything has changed about this in 2.5. > > Has anyone dealt with this? Would a lxml.etree.HTML-based htmlfill be > > useful to anyone? > > I would love to see an lxml implementation of htmlfill. Probably it > could just work on the common ElementTree/lxml interface; I think the > differences won't be too important in this case. Accepting ElementTree > would make it compatible with Kid output. But not Genshi, which is > another format entirely... oh well. It would be nice if the actual parser was pluggable in a non-monkeypatching way, as both lenient and strict parsers would be appropriate in different situations. I don't know yet what the quickest way out of my dilemma will be; if the solution is to write a different FillingParser implementation, I'll post it. js -- Jacob Smullyan office: 212/669-3230 mobile: 917/576-5274 ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642