[xslt] [ENHANCEMENT REQUEST] give URI Resolver hooks in Python API accessto per-invocation data
- From: Craeg K Strong <cstrong arielpartners com>
- To: xslt gnome org
- Subject: [xslt] [ENHANCEMENT REQUEST] give URI Resolver hooks in Python API accessto per-invocation data
- Date: Mon, 14 Oct 2002 13:08:13 -0400
Hello:
I have finally gotten a chance to try out the new resolver hook:
libxml2.setEntityLoader(myResolver)
This is a good start: I would like to propose an enhancement that
would give the resolver function access to per-invocation data.
The way it is today, I can only give the resolver access to module
scoped data. This greatly restricts its power and genericity.
There are two possible approaches:
A) Provide a Resolver class that can be subclassed
class MyResolver(libxml.UriResolver):
def resolve(self, URI, ID, context):
# do something
return resolvedURI
MyResolver resolver(some, data, i, need, later)
libxml2.setEntityLoader(resolver)
B) Make it possible for the resolver to be a bound function,
and provide an extra parameter where invocation-specific data
can be passed:
class FOO:
def resolve(self, URI, ID, context, extra):
return extra
def doStuff(self):
extra = "<foo/>"
libxml2.setEntityLoader(self.resolve, extra)
*******************************
Of the two, I believe (A) is the more powerful approach, but
(B) is equally acceptable, and might be easier to implement.
Also, I am not clear on how multiple invocations of
setEntityLoader() will work. Will each new invocation
cause the old resolver to be replaced with the new, passed-in
one? That would be the preferred behavior.
Thanks very much,
--Craeg
PS Should I log this in bugzilla?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]