elementtree and entities

rurpy at yahoo.com rurpy at yahoo.com
Mon Mar 17 16:48:49 EDT 2008


I need to parse little snipits of xml that come from a file
that has a large DTD that defines hundreds or entities.
But when these snipits are parsed (with elementtree.XML())
without the DTD, the entities are undefined and cause a
parse failure.

Is there any way to tell elementtree to not fail on undefined
entities but just return the entity as text? (Or is this something
I have to get the underlying parser to do?  How?)

Alternatively, can I supply my own entity mapping to elementtree?
Prepending the large DTD to each little snippit before parsing
seems awfully inefficient.



More information about the Python-list mailing list