xmlcalabash1 icon indicating copy to clipboard operation
xmlcalabash1 copied to clipboard

Is it possible to check for the version of Saxon?

Open ndw opened this issue 3 years ago • 5 comments

If you try to combine Saxon 9 with the XML Calabash release for Saxon 10, or vice versa, bad things happen.

Is it possible to check this before the bad things happen?

ndw avatar May 26 '21 13:05 ndw

Hi Norm. What I used on a project is simply to use net.sf.saxon.Version methods, they have not changed in years, and it was enough for my needs at the time.

https://www.saxonica.com/documentation10/index.html#!javadoc/net.sf.saxon/Version

fgeorges avatar May 26 '21 14:05 fgeorges

I think that if you have more than one version of the Saxon classes on the classpath, it's very unpredictable which is going to be loaded, and in general you get a mixture of the two, which causes something random to fall over (eventually). It also means it's unpredictable which version of net.sf.saxon.Version you're going to pick up if there's more than one.

michaelhkay avatar May 26 '21 14:05 michaelhkay

Yes, the version properties that @fgeorges identifies are the ones I had in mind. And I understand that it's unpredictable which will be found first by the classloader.

If I expect 9 and get 9, or expect 10 and get 10, I'll assume things are going to be ok. Maybe they'll fall over later, that's as it will be. But if I expect 9 and get 10, or vice versa, I'd like to give a better error message than you get when the APIs collide.

ndw avatar May 26 '21 15:05 ndw

I guess my issue title is misleading. I know it's possible to check the version. What I am unsure about is whether I can put that check into the process before an API missmatch throws up a security exception or class not found error.

ndw avatar May 26 '21 15:05 ndw

Curiously, XML Calabash doesn't seem to know if it's the 9.9 edition or the 10.0 edition.

ndw avatar Jun 12 '21 13:06 ndw