sgmllib nit

Robin Becker robin at jessikat.fsnet.co.uk
Sat Dec 9 21:13:24 EST 2000


In article <EAsY5.2808$O%.435892 at newsc.telia.net>, Fredrik Lundh
<fredrik at effbot.org> writes
>Robin Becker wrote:
>> The current version of sgmllib doesn't allow the detection of attributes
>> without values.
>
>as stated in the documentation, the current version of sgmllib
>only handles enough SGML to be able to parse HTML.
>
>in HTML, attributes without values (minimized form) are treated
>as boolean attributes.  boolean attributes can have one of three
>formats:
>
>    attribute="attribute" (full form: true)
>    attribute (minimized form: true)
>    (not present: false)
>
>if you need to tell the difference between "true" and "true", you're
>clearly not working with HTML (or anything compatible with HTML).
>
></F>
>
>
I realise that it does that! Unfortunately Zope's dtml isn't HTML.

Which parser should one use to analyse dtml which can contain tags like
<dtml-var standard_html_header>?

The above analysis won't work easily if I have <tag X> as then I'm
presented with attribute 'x' having value 'X'.

I merely want to copy the input to the output whilst making some trivial
changes to the URL's in <A href=URL> style tags. I guess I need to write
my own parser that doesn't make unnecessary assumptions.
-- 
Robin Becker



More information about the Python-list mailing list