Project

Profile

Help

Cannot convert custom URI to URL

Added by Denis Sukhoroslov almost 8 years ago

Hi,

Saxon 9.7. I have custom URIResolver registered in Configuration, it does work properly when I process XML docs. But with the following query

for $uri in fn:uri-collection() return fn:json-doc($uri)

I got an exception: FOUT1170: Cannot convert absolute URI to URL: unknown protocol: bgdm.

Shouldn't the json-doc function resolve custom URIs via the URIResolver also? Or should I register custom URLStreamHandler for this particular case?

Thanks, Denis.


Replies (2)

RE: Cannot convert custom URI to URL - Added by Michael Kay almost 8 years ago

The URIResolver interface defined by JAXP has a resolve() method that returns a org.xml.sax.Source object, which means it is only suitable for handling XML resources. Saxon therefore defines its own resolver interface for text resources, namely the UnparsedTextURIResolver, which is used for functions like unparsed-text() and json-doc().

There seems to be a limitation (which I've just discovered) that the UnparsedTextURIResolver can only be set on the Controller or the DynamicQueryContext, which makes it somewhat inconvenient, but you should be able to find your way to the Controller - the details depend on how exactly you are running the stylesheet or query.

RE: Cannot convert custom URI to URL - Added by Denis Sukhoroslov almost 8 years ago

Thank you so much for the info, it works now.

    (1-2/2)

    Please register to reply