Stefan Behnel added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19483>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to