Project

Profile

Help

Support #4434

closed

Using SaxonTransformerFactory sometimes leaves the Configuration without an APIProvider

Added by Alex Jitianu over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2020-01-20
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
9.9
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Hello,

For me it all starts with SaxonTransformerFactory:

  1. 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,
  2. 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

Actions #1

Updated by Michael Kay over 4 years ago

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.

Actions #2

Updated by Alex Jitianu over 4 years ago

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?

Actions #3

Updated by Michael Kay over 4 years ago

well, you can always supply data directly from the calling application to the class implementing the extension function before the Saxon transformation starts...

Actions #4

Updated by Michael Kay over 4 years ago

  • 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