Trouble writing to database: RSS-reader

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Jan 23 16:47:00 EST 2008


En Wed, 23 Jan 2008 14:06:10 -0200, Arne <arne.k.h at gmail.com> escribió:

> On Jan 21, 11:25 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
> wrote:
>> > On 21 Jan, 19:15, Bruno Desthuilliers <bruno.
>> > 42.desthuilli... at wtf.websiteburo.oops.com> wrote:
>>
>> >> This should not prevent you from learning how to properly parse XML
>> >> (hint: with an XML parser). XML is *not* a line-oriented format, so  
>> you
>> >> just can't get nowhere trying to parse it this way.
>>
>> Try ElementTree instead; there is an implementation included with  
>> Python  
>
> This look very interesting! But it looks like that no documents is
> well-formed! I've tried several RSS-feeds, but they are eighter
> "undefined entity" or "not well-formed". This is not how it should be,
> right? :)

Well, the RSS feed "should" be valid XML...
Try a more forgiving parser like BeautifulStone, or preprocess the input  
with Tidy or a similar program before feeding it to ElementTree.

-- 
Gabriel Genellina




More information about the Python-list mailing list