[lxml-dev] Problem handling  

Stefan Behnel stefan_ml at behnel.de
Tue Jun 24 09:00:32 CEST 2008


Hi,

Brad Smith wrote:
> I am trying to handle some html data (the content of which I don't
> have control over) with lxml. The problem is that whenever   is
> encountered lxml.etree.fromstring throws "XMLSyntaxError: Entity
> 'nbsp' not defined" and parsing fails.

Are you using the HTML parser? Pass an HTMLParser() instance to fromstring()
or try the fromstring() in lxml.html.

Stefan




More information about the lxml-dev mailing list