You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Riaan Annandale <ri...@mundane.co.za> on 2017/12/13 11:56:34 UTC

RE: XQuery NPE going from saxon 9.5 to 9.7 (upgraded camel from 2.17.4-> 2.20.1)

Hiya

Further to this/ extra information, I downloaded SaxonHE9-7-18 from sourceforge, and using the command line, I was able to get the xquery to work correctly:
$ java -cp saxon9he.jar net.sf.saxon.Query transformBody.xquery -s:data.xml
<?xml version="1.0" encoding="UTF-8"?>
<o><variables><Name>someName</Name></variables></o>

I was hoping to see the same behavior using Saxon outside of camel, so at this point it looks like it has something to do with camel and not SaxonHE

Sent from Mail for Windows 10

From: Riaan Annandale
Sent: Wednesday, 13 December 2017 12:33 PM
To: users@camel.apache.org
Subject: XQuery NPE going from saxon 9.5 to 9.7 (upgraded camel from 2.17.4-> 2.20.1)

Hi guys

I think saxon went to 9.7 in camel 2.18 (could be 19). Anyway, I used the latest to illustrate my problem (2.20.1 at the time of writing)

I have a routes that receive XML payloads which I then transform via xqueries. Inside these I use local functions for readability (read: it’s the first thing I tried when solving my problem and it worked). 

Since saxon went to 9.7 I get a null pointer exception when an xquery containing a local function tries to process the XML.

To demonstrate this, I have made a GitHub project:
https://github.com/rannandale/xqueryIssue

In the project I use two xqueries to transform the same source. 
- One uses an inline for loop:
<o>
	<variables>{for $v in /root/Data return $v/Name}</variables>
</o>

- One uses the local function style:
declare function local:loopMe($nodes)
{
   for $node in $nodes
    return 
<variables>{$node/*:Name}</variables>
};

<o>
{local:loopMe(/root/Data)}
</o>

The latter is the one that returns the NPE.

I know I could probably go refactor all my xqueries to match the inline style, but I figured I’d see if there is an issue here other than PEBKAC. They also get quite complex, so it’s quite a bit of work.

The camel website says I should ask on the mailing list first before raising an issue, so here I am – first post and all.

Thanks guys
Riaan

Sent from Mail for Windows 10