Discussion:
How to Set Up XPath/XQuery With Latest POI and XMLBeans Using Maven?
Eliot Kimber
2018-07-17 11:48:59 UTC
Permalink
I'm starting a new POI-based maven project.

I'm converting XML into DOCX and I'm using XMLBeans to navigate my incoming XML.

Everything is working great but...

Now I want to use some XPath and XQuery with my XmlCursor and I'm unable to work out the right Maven dependency incantations in order to get a working system.

I'm using the following dependencies:

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.8.0-12</version>
</dependency>

I'm pretty sure I need the separate xmlbeans-xpath library but the only thing I can find in the Maven repo is 2.6.0 which dates from 2012 and if I include that dependency the fetch fails because it can't find the ancient Saxon library it's expecting.

If I run my code:

cursor.selectPath("*:cols/*:col");

With the above dependencies then I get this failure, not surprisingly:

java.lang.RuntimeException: Trying XBeans path engine... Trying XQRL... Trying XDK... Trying delegated path engine... FAILED on *:cols/*:col

So my question is:

With POI 3.0.0 and using Maven, what do I need to do to get XPath/XQuery support working?

Perhaps a better question might be: what would be involved in binding XmlBeans to Saxon 9.8.*? If it's not too much work that's probably something I can do and contribute back to the project. It would be nice, for example, to be able to use XPath/XQuery 3 in this context.

Thanks,

Eliot
--
Eliot Kimber
http://contrext.com




---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org
pj.fanning
2018-07-17 17:17:37 UTC
Permalink
When we release xmlbeans 3.0.0, we didn't release a new version of
xmlbeans-xpath jar. The 2.6.0 version of xmlbeans-xpath should work ok with
xmlbeans 3.0.0. The Saxon dependency that it has is old though.
It was built with
https://master.dl.sourceforge.net/project/saxon/OldFiles/9.0/9.0.0.4/saxonb9-0-0-4j.zip

This is documented at https://xmlbeans.apache.org/download/index.html

If you want to try building an xmlbeans-xpath jar for yourself that uses a
newer saxon jar, look at the link above and download the xmlbeans source
from svn. You can modify the build.xml to change the URL for the saxon
download.





--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org
Eliot Kimber
2018-07-17 19:33:09 UTC
Permalink
Thanks--I'll take a look. Should be easy enough to update the Saxon API usage (he said without actually looking at the code...)

Cheers,

E.

--
Eliot Kimber
http://contrext.com


On 7/17/18, 1:17 PM, "pj.fanning" <***@yahoo.com> wrote:

When we release xmlbeans 3.0.0, we didn't release a new version of
xmlbeans-xpath jar. The 2.6.0 version of xmlbeans-xpath should work ok with
xmlbeans 3.0.0. The Saxon dependency that it has is old though.
It was built with
https://master.dl.sourceforge.net/project/saxon/OldFiles/9.0/9.0.0.4/saxonb9-0-0-4j.zip

This is documented at https://xmlbeans.apache.org/download/index.html

If you want to try building an xmlbeans-xpath jar for yourself that uses a
newer saxon jar, look at the link above and download the xmlbeans source
from svn. You can modify the build.xml to change the URL for the saxon
download.





--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org

Loading...