expat having problems with entities (&)

Rami Chowdhury rami.chowdhury at gmail.com
Fri Dec 11 16:39:58 EST 2009


On Fri, Dec 11, 2009 at 13:23, nnguyen <nguyenn at gmail.com> wrote:
>
> Any ideas on any expat tricks I'm missing out on? I'm also inclined to
> try another parser that can keep the string together when there are
> entities, or at least ampersands.

IIRC expat explicitly does not guarantee that character data will be
handed to the CharacterDataHandler in complete blocks. If you're
certain you want to stay at such a low level, I would just modify your
char_data method to append character data to self.current_data rather
than replacing it. Personally, if I had the option (e.g. Python 2.5+)
I'd use ElementTree...


-- 
--------
Rami Chowdhury
"Never assume malice when stupidity will suffice." -- Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)



More information about the Python-list mailing list