Project

Profile

Help

Bug #4849

closed

Loading configuration file in Saxon-PE fails

Added by Michael Kay almost 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Configuration
Sprint/Milestone:
-
Start date:
2020-12-04
Due date:
% Done:

100%

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

Description

Calling Transform from the command line, with the Saxon-PE Jar files on the classpath, and with a configuration file that specifies edition="PE" and that includes the line

<extensionElement namespace="http://saxon.sf.net/sql"
         factory="net.sf.saxon.option.sql.SQLElementFactory"/>

fails saying

Warning on line 8 column 63 of config.xml:
   Extension elements are not available in Saxon-HE
Extension elements are not available in Saxon-HE

Reported on StackOverflow at https://stackoverflow.com/questions/65141470/saxon-config-file-using-pe-extension-elements-are-not-available-in-saxon-he

Actions #1

Updated by Michael Kay almost 4 years ago

The problem is that

protected ConfigurationReader makeConfigurationReader() {
        return new ConfigurationReader();
    }

at Configuration#472 has an override in EnterpriseConfiguration to create a ConfigurationReaderEE, but it has no override in ProfessionalConfiguration to create a ConfigurationReaderPE.

Actions #2

Updated by Michael Kay almost 4 years ago

  • Status changed from New to Resolved
  • Fix Committed on Branch 10, trunk added

Fix committed, but we need to think further about the testing strategy for such problems.

Actions #3

Updated by Sebastian Vogel almost 4 years ago

Is this fix in saxon-pe-10.3?

Actions #4

Updated by Michael Kay almost 4 years ago

It looks as if this fix wasn't committed on the 10.x branch, due to a mix up when we reorganised the repository structure (but there hasn't been a public maintenance release since then anyway). It's a simple fix and I will apply it now so it comes out in the next maintenance release.

Actions #5

Updated by Sebastian Vogel almost 4 years ago

Thanks @Michael Kay for digging into this. Is there an ETA on that maintainance release? Or would I be able to use a patched version somehow till the new release goes live?

Actions #6

Updated by Michael Kay almost 4 years ago

It turns out to be a bit more complicated that I thought, which might be why the history is also a bit confused. At present, on the 10.x branch,

  • When running from the command line, net.sf.saxon.Transform calls Configuration.readConfiguration(new StreamSource(configFile)); which is a static method (the same for all editions) that does
        Configuration tempConfig = newConfiguration();
        return tempConfig.readConfigurationFile(source);

The kind of configuration held in tempConfig depends solely on what JAR file is on the classpath. The readConfigurationFile(source) method instantiates a ConfigurationReader in HE, and a ConfigurationReaderPE in EE (sic) - there is no separate ConfigurationReaderEE. There should be an override of the method in PE.

There's a separate two-argument method Configuration readConfigurationFile(Source source, Configuration baseConfiguration). This exists only in HE, but it invokes makeConfigurationReader() which (correctly) has separate versions in HE and PE. But this version is used only when invocation is via the fn:transform() function.

When a configuration file is specified using the JAXP TranformerFactory interface, each TransformerFactory instantiates the correct kind of ConfigurationReader and the logic here appears to be correct.

When a configuration file is specified using the s9api method new Processor(Source), we invoke Configuration.readConfiguration(source) which appears to follow the same (incorrect) path as command-line invocation.

Actions #7

Updated by Michael Kay almost 4 years ago

A workaround is to set the extension element factory programmatically rather than via a configuration file, using the method ProfessionalConfiguration.setExtensionElementNamespace(). If running from the command line, you can do this in a -init hook, or by subclassing net.sf.saxon.Transform and overriding the initializeConfiguration() method.

Actions #8

Updated by Michael Kay almost 4 years ago

Confirmed that the problem was already fixed on the development branch.

Actions #9

Updated by Sebastian Vogel almost 4 years ago

What are the next steps on this?

Actions #10

Updated by O'Neil Delpratt over 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.5 added

Bug fix applied to Saxon 10.5 maintenance release.

Actions #11

Updated by Jirka Kosek over 1 year ago

Hi, any chance of backporting this to 9.9?

I need to call transformation that uses extension elements from exist-db and exist-db still uses Saxon 9.9.

Actions #12

Updated by Norm Tovey-Walsh over 1 year ago

Saxonica Developer Community writes:

Hi, any chance of backporting this to 9.9?

I need to call transformation that uses extension elements from
exist-db and exist-db still uses Saxon 9.9.

I think another maintenance release on the 9.x branch is very unlikely.

Be seeing you,
norm

--
Norm Tovey-Walsh
Saxonica

Please register to edit this issue

Also available in: Atom PDF