Project

Profile

Help

Debugging URI Resolution Failures

Added by Anonymous almost 15 years ago

Legacy ID: #7470110 Legacy Poster: W. Eliot Kimber (drmacro)

I have integrated a custom URI resolver with saxon XSLT processing using the S9API (9.1.0.7), e.g.: XsltCompiler compiler = proc.newXsltCompiler(); compiler.setErrorListener((ErrorListener)messageListener); compiler.setURIResolver(new RSuiteInternalURIResolver(context)); Where RSuiteInternalURIResolver is my resolver getting things from the repository using a private URI syntax. For one complex XSLT that includes multiple levels of includes and imports, this works fine: all the references go through my resolver and the transform loads and runs fine. For another complex XSLT, it fails with a "malformed URL syntax" message on my URN scheme, meaning it's not going though my resolver for some resolution action. When I trace the resolve() method in my resolver, I can watch the resolution requests for all the includes and imports in the inclusion tree, which all work. But then it comes to one particular included file, which fails with the malformed URL message without ever calling my resolve() method. This file is importing the same files imported earlier. The exception is being thrown by this line from Sender: parser.parse(source.getInputSource()); Where the source is a SAXSource that my resolver constructs (it sets the ErrorHandler and the entity resolver). I verified that before the failing parse call my URI resolver is the configured URI resolver. The transform of course works outside of this processing context. I'm at a loss as to how to debug this further: the diagnostics from the parse() method don't tell me anything useful (like what the URL string was that was malformed) or where the reference occurred. Any hints on what I can do to try figure out the real cause? Thanks, Eliot


Replies (2)

RE: Debugging URI Resolution Failures - Added by Anonymous almost 15 years ago

Legacy ID: #7470467 Legacy Poster: Michael Kay (mhkay)

I'm a bit confused because you say that parser.parse(source.getInputSource) is being called, and source is a SAXSource constructed by your URIResolver, but you also seem to suggest that your URIResolver isn't being called. What's in the SAXSource, specifically in its InputSource? If it just contains a URI (systemID), then Saxon is going to pass that SystemId to the XMLReader's parse() method, which is going to attempt to dereference it (with the help of the EntityResolver if supplied). I would think it's that dereferencing that's failing. Because this is being done by the XML parser rather than by Saxon itself, Saxon doesn't have much control over the diagnostics. It would be useful to see the messages you are getting more precisely, however.

RE: Debugging URI Resolution Failures - Added by Anonymous almost 15 years ago

Legacy ID: #7470782 Legacy Poster: W. Eliot Kimber (drmacro)

Ah--that may be the problem--I'll dig into that direction. The SAXSource should be a wrapper around an Input Stream but it's possible I've done something silly in my code that is just producing a URI instead. Thanks, E.

    (1-2/2)

    Please register to reply