Support #4434
closed
Using SaxonTransformerFactory sometimes leaves the Configuration without an APIProvider
Fixed in Maintenance Release:
Description
Hello,
For me it all starts with SaxonTransformerFactory:
- The default constructor creates an Processor which in turn calls net.sf.saxon.Configuration.setProcessor(ApiProvider). This means that an Initializer instance will have access to an APIProcessor,
- The other constructor, that receives a Configuration object, creates a Processor that doesn't call the aforementioned method. This means that the Initializer will not have access to an APIProcessor.
I just want to know if this is by design and I should take care to set an APIProvider to my configuration instance or if it's actually something that the factory/processor should take care of.
Thank you,
Alex
It's legitimate for the ApiProvider to be null. Saxon itself appears to no longer use this property. I think it was provided primarily for extension functions, for example if we supply a node to an extension function then the extension function might want to create a serializer, and this property enables it to get back to the originating s9api Processor so that it can do so. It's a rather pragmatic kludge anyway, since it's quite possible, for example, for a JAXP TransformerFactory and an XQJ DataSource to share the same Configuration, in which case there's no way the Configuration can remember both of them.
I think the fact that new Processor(Configuration config)
doesn't call config.setProcessor()
is deliberate. The thinking is that this Processor
isn't responsible for creating this Configuration
; it doesn't own it, and shouldn't claim ownership of it.
Michael Kay wrote:
I think it was provided primarily for extension functions, for example if we supply a node to an extension function then the extension function might want to create a serializer, and this property enables it to get back to the originating s9api Processor so that it can do so.
Yes, someone complain about this very situation, in an extension function. Is there another recommended way to get access to such an API from an extension function?
well, you can always supply data directly from the calling application to the class implementing the extension function before the Saxon transformation starts...
- Tracker changed from Bug to Support
- Status changed from New to Closed
Marking this closed; the product is working as designed.
Please register to edit this issue
Also available in: Atom
PDF