HTMLParser problem

Valkyrie valkyrie at cuhk.edu.hk
Tue Nov 16 09:14:33 EST 2004


Thank you. That means there is no way to deal with it using simple python
built-in functions?


Richard Brodie wrote:

> "Valkyrie" <valkyrie at cuhk.edu.hk> wrote in message news:1100610863.75889 at eng-ser4...
> 
> 
>><![if !IE]>
>>
>>HTMLParser.HTMLParseError: unknown declaration: 'if !IE', at line 4, column 1
>>
>>May I ask why such error is raised?
> 
> 
> HTMLParser isn't very forgiving of bad HTML; you feed it syntactically invalid HTML,
> it tends to give you errors. That includes Microsoft only extensions like <![if !IE.
> Unless you know you have known valid sources it may be best to use one of
> the forgiving parsers: Beautiful Soup, UTidylib, libxml etc.. (see many past discussions).
> Uche's article: http://www.xml.com/pub/a/2004/09/08/pyxml.html may be of interest.
> 
> 



More information about the Python-list mailing list