Brad Clements wrote:
On 20 Apr 2006 at 19:26, Stefan Behnel wrote:
parser = XMLParser() parser.resolvers.add(my_resolver)
Great, so does this resolver only get called when this one parser is used, or is it global to the process (like it is with libxml2)?
It's currently local to a parser. I'm looking for a module level API also, but I'm not sure yet how to make it look pretty. Anyway, the parser-level API is likely the preferred one anyway.
I'll see how to integrate that in other places of the API, especially XSLT and schemas. Anyway, this works so far. Feel free to comment on
If I create a parser, add my resolver, then load an .xslt file into that parser, I'd expect that subsequent use of the parsed document in a transform would continue to use my resolver. and that my resolver would not be called by other documents or transforms.
So you'd want the resolvers stored at a per-document level rather than in XSLT or RelaxNG? That would totally simplify the API. I think that's a good idea. So, just to make that clear: 1) resolvers are only registered with parsers. 2) once a document is parsed, a reference to the parser-local resolvers is kept in the document to be reused in all operations where resolving is involved (XSLT, RelaxNG, XInclude, etc.). Questions: * if you parse an XSL document with one set of resolvers and then use it to transform an XML document with another set of resolvers - which ones should be used during the transform? My guess is: the document ones, but that may break lookups at the XSLT level (which libxslt handles in the standard resolvers, even for lookups inside the stylesheet itself!). Keeping these lookups separated by source document can get pretty hard, I assume. * should the document registries be independent of the parser registries or should they reflect updates in their original parser?
Is that what really happens? If so, nirvana!
Not yet, but close :) Stefan