Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send more details to resolver when possible about nature of request #148

Closed
raducoravu opened this issue Jul 5, 2023 · 7 comments
Closed

Comments

@raducoravu
Copy link

Let's say I configure in Calabash the "com.xmlcalabash.core.XProcConfiguration.uriResolver" to be my custom implementation of "org.xmlresolver.Resolver".
In the "net.sf.saxon.lib.StandardUnparsedTextResolver" the "resolve" call sets of details about the nature of the request (nature, purpose).
But back in my "org.xmlresolver.Resolver" implementation the only callback I can override is "resolve(href, base)" where I no longer know details about the nature of the resolution and if for example on the "resolve(href, base)" I return a SaxSource, the StandardUnparsedTextResolver will not use it as it expects a stream source.

@ndw
Copy link
Collaborator

ndw commented Aug 22, 2023

Yes. I think we should be able to do better here. The whole tangled mess of URI-related/resolver-related APIs is a mess.

@ndw
Copy link
Collaborator

ndw commented Aug 29, 2023

Indeed, the problem with the unparsed text resolver is clearly my fault. Here's a sketch of a proposal for a new design. Comments most welcome: https://so.nwalsh.com/2023/08/29-xmlresolver

@raducoravu
Copy link
Author

@ndw sounds good, your proposed changes are probably more than enough for our original purpose.

@ndw
Copy link
Collaborator

ndw commented Sep 14, 2023

You can (and I would really appreciate it if you did!) try them out now: 6x-SNAPSHOT

@raducoravu
Copy link
Author

@ndw sorry, we are getting close to a release, found some time to look a bit into this. This link you mention in your blog post does not work for me: https://oss.sonatype.org/content/repositories/snapshots/
Also running " ./gradlew build --stacktrace" on the sources does not work for me:

 Caused by: java.io.IOException: Cannot run program "./gradlew" (in directory "/Users/.../Downloads/xmlresolver-6.0.3-SNAPSHOT/data"): error=2, No such file or directory

@ndw
Copy link
Collaborator

ndw commented Oct 2, 2023 via email

@ndw
Copy link
Collaborator

ndw commented Aug 6, 2024

This is now shipping in the 6.x resolver, so I'm going to close this. The tl;dr is, I think, that you can provide your own extension of the XMLResolver class that overrides the lookup() method. That let's you see the details of the request. You can use super.lookup() to find out what the resolver is proposing, and then change that if you need to.

@ndw ndw closed this as completed Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants