Hi Christian,
I'm having trouble getting an XML Catalog to work in BaseX 9.7.2 running on Java 8. The XML Catalog is working properly in BaseX and Saxon using Java 17. However, if I keep everything the same and switch to Java 8 the XML Catalog doesn't work. The error messages when running on Java 8 indicate that the XML Catalog is not being used at all. The obvious solution of updating the environment to a more recent version of Java is not so easy in this case.
I have the XML Catalog location configured as an absolute file system URI in the system properties org.basex.catfile, xml.catalog.files, and javax.xml.catalog.files. Option db:intparse is set to false and option db:dtd is set to true. I have set the class path to include both the Apache XML Resolver (xml-resolver:xml-resolver:1.2) and the xmlresolver.org XML Resolver (org.xmlresolver:xmlresolver:4.4.0).
It is my understanding that BaseX will use Norm Tovey-Walsh's XML Resolver from xmlresolver.org if it is found on the class path, or fall back to Java's built in XML resolver. I see the logic for this check on which catalog resolver to use in org.basex.util.Resolver.
Do you have any suggestions on what to try, or is this pointing to a possible bug somewhere?
Thank you, Vincent
______________________________________________ Vincent M. Lizzi Head of Information Standards | Taylor & Francis Group 530 Walnut St., Suite 850, Philadelphia, PA 19106 E-Mail: vincent.lizzi@taylorandfrancis.com Web: www.tandfonline.com
Taylor & Francis is a trading name of Informa UK Limited, registered in England under no. 1072954
"Everything should be made as simple as possible, but not simpler."
Information Classification: General
Hi Vincent,
XML catalogs and Java 8 are an ungrateful combination indeed. As you know, support for catalogs will improve a lot with BaseX 10, as JDK 11 comes with its own catalog resolver. With BaseX 10, we’ll also support Norm’s XML resolver, as you’ve already discovered (we’ll update our documentation soon).
Due to limited resources, we decided to focus on the new version exclusively. It’s interesting to hear, though, that your code is working with BaseX 9 and Java 17. Maybe it’s the inbuilt XML resolver that’s used by Java 17, no matter if an external resolver is added to the classpath? All I can do is guess …
Maybe JDK developers would be able to answer that question if we managed to create some self-contained code in Java?
Best, Christian
Hi Christian,
Thank you for your reply! That makes sense. I worked around the problem for now by implementing an XML Catalog Resolver in XQuery. I've made it available on GitHub in case other people might need it.
For example:
import module namespace resolver = "xml-catalog-resolver" at "https://raw.githubusercontent.com/vincentml/xml-catalog-resolver/main/xml-ca..."; let $doc := "example.xml" let $catfile := db:option("catfile") return resolver:parse-xml($doc, $catfile)
Kind regards, Vincent
_____________________________________________ Vincent M. Lizzi Head of Information Standards | Taylor & Francis Group vincent.lizzi@taylorandfrancis.com
Information Classification: General
-----Original Message----- From: Christian Grün christian.gruen@gmail.com Sent: Thursday, July 7, 2022 5:27 AM To: Lizzi, Vincent Vincent.Lizzi@taylorandfrancis.com Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Java 8 and XML Catalog
Hi Vincent,
XML catalogs and Java 8 are an ungrateful combination indeed. As you know, support for catalogs will improve a lot with BaseX 10, as JDK 11 comes with its own catalog resolver. With BaseX 10, we’ll also support Norm’s XML resolver, as you’ve already discovered (we’ll update our documentation soon).
Due to limited resources, we decided to focus on the new version exclusively. It’s interesting to hear, though, that your code is working with BaseX 9 and Java 17. Maybe it’s the inbuilt XML resolver that’s used by Java 17, no matter if an external resolver is added to the classpath? All I can do is guess …
Maybe JDK developers would be able to answer that question if we managed to create some self-contained code in Java?
Best, Christian
It may help to include the link to the repository: https://github.com/vincentml/xml-catalog-resolver
Kind regards, Vincent _____________________________________________ Vincent M. Lizzi Head of Information Standards | Taylor & Francis Group vincent.lizzi@taylorandfrancis.com
Information Classification: General
-----Original Message----- From: Lizzi, Vincent Sent: Thursday, July 7, 2022 9:12 AM To: 'Christian Grün' christian.gruen@gmail.com Cc: basex-talk@mailman.uni-konstanz.de Subject: RE: [basex-talk] Java 8 and XML Catalog
Hi Christian,
Thank you for your reply! That makes sense. I worked around the problem for now by implementing an XML Catalog Resolver in XQuery. I've made it available on GitHub in case other people might need it.
For example:
import module namespace resolver = "xml-catalog-resolver" at "https://raw.githubusercontent.com/vincentml/xml-catalog-resolver/main/xml-ca..."; let $doc := "example.xml" let $catfile := db:option("catfile") return resolver:parse-xml($doc, $catfile)
Kind regards, Vincent
_____________________________________________ Vincent M. Lizzi Head of Information Standards | Taylor & Francis Group vincent.lizzi@taylorandfrancis.com
Information Classification: General
-----Original Message----- From: Christian Grün christian.gruen@gmail.com Sent: Thursday, July 7, 2022 5:27 AM To: Lizzi, Vincent Vincent.Lizzi@taylorandfrancis.com Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Java 8 and XML Catalog
Hi Vincent,
XML catalogs and Java 8 are an ungrateful combination indeed. As you know, support for catalogs will improve a lot with BaseX 10, as JDK 11 comes with its own catalog resolver. With BaseX 10, we’ll also support Norm’s XML resolver, as you’ve already discovered (we’ll update our documentation soon).
Due to limited resources, we decided to focus on the new version exclusively. It’s interesting to hear, though, that your code is working with BaseX 9 and Java 17. Maybe it’s the inbuilt XML resolver that’s used by Java 17, no matter if an external resolver is added to the classpath? All I can do is guess …
Maybe JDK developers would be able to answer that question if we managed to create some self-contained code in Java?
Best, Christian
BTW: Just to note that Saxon 11.3 has been working fine for me under Basex 9.x, But it requires including the included xmlresolver files in the class path:
export CLASSPATH=/usr/local/Cellar/saxon/11.3/libexec/saxon-he-11.3.jar:/usr/local/Cellar/saxon/11.3/libexec/lib/*.jar
But I haven’t done any special testing using the resolver from either Saxon or BaseX — Just running my current development code without noticing any problems.
( If you only include saxon-he-11.3.jar, xslt:processor() and xslt:version() will make it appear that it’s working under BaseX, but xslt:transform() will fail on not finding resolver classes. )
I’ve had my share of resolver issues in the past, and happily discovered that by upgrading JDK, I could get resolver to work in some apps without any code change, just by adding '-Djavax.xml.catalog.files=…’ to the command line. But I spent a lot of effort trying to get resolver to work in cases where it apparently wasn’t intended to work ( like for XInclude’s ). I think Norm’s replacement does try to provide a lot more functionality — I’ll have to try intentionally using it!
— Steve M.
On Jul 7, 2022, at 5:26 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Vincent,
XML catalogs and Java 8 are an ungrateful combination indeed. As you know, support for catalogs will improve a lot with BaseX 10, as JDK 11 comes with its own catalog resolver. With BaseX 10, we’ll also support Norm’s XML resolver, as you’ve already discovered (we’ll update our documentation soon).
Due to limited resources, we decided to focus on the new version exclusively. It’s interesting to hear, though, that your code is working with BaseX 9 and Java 17. Maybe it’s the inbuilt XML resolver that’s used by Java 17, no matter if an external resolver is added to the classpath? All I can do is guess …
Maybe JDK developers would be able to answer that question if we managed to create some self-contained code in Java?
Best, Christian
Hi,
Am 07.07.2022 um 17:52 schrieb Majewski, Steven Dennis (sdm7g):
BTW: Just to note that Saxon 11.3 has been working fine for me under Basex 9.x, But it requires including the included xmlresolver files in the class path:
export CLASSPATH=/usr/local/Cellar/saxon/11.3/libexec/saxon-he-11.3.jar:/usr/local/Cellar/saxon/11.3/libexec/lib/*.jar
Oh. I stumbled upon the same thing. But I don't add a directory to the class path where I store a stand alone copy of an XML resolver (and Saxon).
There is a jar that seems to contain everything needed and I put it in lib/custom together with saxon-he-11.3.jar (and that is added to the classpath by the startup scripts):
lib/custom/Saxon-HE-11.3.jar lib/custom/xmlresolver-4.3.0.jar
But I haven’t done any special testing using the resolver from either Saxon or BaseX — Just running my current development code without noticing any problems.
Didn't do a formal test either, works for me as described. [...]
— Steve M.
Best regards
basex-talk@mailman.uni-konstanz.de