> I just sent in a patch to libxml2 that provides python bindings for
> local catalog support.
Excellent!
It seems to work in simple tests, but I'd like
> to test it with ZopeXMLMethods as well. What's the best way to go about
> testing?
There is already a catalog test: test_30 in TestXSLTMethods.
There should probably be more catalog tests. The catalog
file for the test has a rewrite rule for URNs, which leaves
lots of things untested, like mapping one URL to another,
and all the other myriad things catalogs can do.
Feel free to clone test_30 and add some more variations.
Eventually if there are enough of these kinds of tests
we could always separate them out into a separate
TestCatalogs.py module...
>
> Looking through the unit tests, it appears that XML catalog support is
> tied into URN resolving. Is this correct?
Nah, I just used a URN for the test, and had to implement
extra code to make urns resolve to zope objects-- relative
urls already do i think. Check out FourSuiteProcessor.py It is using a CatalogInputSource
which will automagically do entity resolving/uri resolving
using the catalog. To make it work I had to pass in
my URN-aware entity resolver as the resolver for the input
source. The urn-aware resolver defaults back to the
regular resolver in the case of non-urns.
The CatalogInputSource is quite a useful abstraction, but
absent from all the other XSLT implementations as of today...
I know that libxml2 supports
> external resolvers and even has python bindings (eg.
> libxml2.setEntityLoader(myResolver)), but ZopeXMLMethods doesn't seem to
> use it. Has this been tried before? I presume we would just need to
> write a resolver to map UR[LN]s into Zope objects. Are there some
> pitfalls to watch out for?
Well, its always a bit of a challenge. Hopefully the
URN resolver implementations in the other XSLT processor
modules will be helpful. The main thing is to avoid
going *outside* of the Zope context. If you do that,
you will lose authentication information and cookies,
which means that many of the lookups will _fail_.
That is why having a Zope-aware resolver, that knows
how to turn relative URLs into Zope objects directly,
is so important. I believe I have documented this
fact in the code comments...
--Craeg
>
> -- Brent
|