This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients brechtm, eli.bendersky, r.david.murray, scoder
Date 2013-11-03.16:43:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <52767D03.3040202@behnel.de>
In-reply-to <1383476320.61.0.0930927196631.issue19483@psf.upfronthosting.co.za>
Content
Brecht Machiels, 03.11.2013 11:58:
> With Python 3.2, I subclassed ElementTree.XMLParser to set ExternalEntityRefHandler on the XMLParser's (expat) 'parser' member

This sounds like a request for a missing feature to me. Here is how lxml
handles it:

http://lxml.de/resolvers.html

> I understand the 'parser' member is not part of the public API

Correct, although the fact that it is not prefixed with an underscore is
rather unfortunate. IMHO, there is no guarantee that the underlying parser
will always be expat, and in fact, it is not in lxml.

> I see two possible solutions:
> 1) Have XMLParser (both the C and Python versions) accept an optional parser argument, so that a custom parser can be passed in.

-1. IMHO, the underlying parser should not be made a part of the API.
Instead, whatever features it provides that are needed on user side should
be mapped and abstracted in one way or another. Resolving external entity
references is something that should not be done as low-level as expat.
History
Date User Action Args
2013-11-03 16:43:48scodersetrecipients: + scoder, r.david.murray, eli.bendersky, brechtm
2013-11-03 16:43:48scoderlinkissue19483 messages
2013-11-03 16:43:47scodercreate