I'm attempting to use relatively complcated xpaths in a call to
selectPath(), so apparently I need Saxon.
Specifically, I need to do the following:
Operation 1) Load an XML file and run an xslt , resulting in a new
Document
Operation 2) Pass this Document into my compiled XMLBeans classes
Operation 3) Run a complex xpath on my root XMLBeans
ExperimentDocument class, using ExperimentDocument.selectPath()
This seems to be pretty hard to do.
Here's what I've tried so far:
A) XMLBeans 2.30.0 with nothing added:
Operation 1) Works fine using using the built in JDK 5 Transformer
Operation 2) Works fine
Operation 3) When I execute selectPath(), I get the usual warning:
Trying XBeans path engine... Trying XQRL... Trying Saxon... FAILED
on //metadata
B) XMLBeans with Saxon 8.8:
Classpath:
${PROJECTDIR}/lib/experiment.jar
${PROJECTDIR}/vendors/jetbrains_annotations/annotations.jar
${PROJECTDIR}/vendors/xmlbeans-2.3.0/lib/xbean.jar
${PROJECTDIR}/vendors/xmlbeans-2.3.0/lib/xmlpublic.jar
${PROJECTDIR}/vendors/xmlbeans-2.3.0/lib/xmlbeans-qname.jar
${PROJECTDIR}/vendors/xmlbeans-2.3.0/lib/resolver.jar
${PROJECTDIR}/vendors/xmlbeans-2.3.0/lib/jsr173_1.0_api.jar
${PROJECTDIR}/vendors/xmlbeans-2.3.0/lib/xbean_xpath.jar
${PROJECTDIR}/vendors/commons-io-1.3.1/commons-io-1.3.1.jar
${PROJECTDIR}/vendors/saxonb8-8j_0/saxon8.jar
${PROJECTDIR}/vendors/saxonb8-8j_0/saxon8-dom.jar
${PROJECTDIR}/vendors/saxonb8-8j_0/saxon8-xpath.jar
Operation 1) Fails with this error during the XSLT execution:
Error at element constructor <experiment-steps> on line 9 of :
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create
or change an object in a way which is incorrect with regard to
namespaces.
Question 1) Why is Saxon being used to run the XSLT? It seems like
it's getting automatically plugged in to the built in JDK/JAXP
engine, without me having to configure it. Is XMLBeans doing this?
Question 2) All I really want to do is use the builtin JDK library
most of the time, and just use Saxon to enhance XMLBeans' xpath
support. Is this possible?
Question 3) Alternatively, is there any way to get XMLBeans to use
the built in JDK xpath facilities instead of its own or Saxon's? The
kicker is that the built in JDK xml tools can execute my xpath fine.
I'd rather avoid Saxon completely, as it seems really finicky and the
XMLBeans/Saxon tight version binding seems like it's going to be a
continual pain to deal with.
Question 4) If there's no way to use the JDK for the XSLT, then I
guess I need to figure out the Saxon XSLT problem. This same XSLT run
on the same source xml file works fine when executed in StylusStudio
using the embedded Saxon 8.9 library, and the built in JDK xslt
engine doesn't, either. So I'm left thinking that there's some
obscure Saxon initialization that's different between the way
StylusStudio sets up Saxon, and the way it's getting setup in my app.
Any thoughts?
Thanks for any help,
Willis Morse
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]