XPathException for custom xpath function in 3.9

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

XPathException for custom xpath function in 3.9

lacco
Hi!

I have written a custom xpath function to access a complex data instance in a more elegant way (as a shortcut). This function has been working fine in Orbeon 3.8, but after upgrading to Orbeon 3.9, I get an XPathException ("org.orbeon.saxon.trans.XPathException: Casting from element(bar, xs:anyType) to xs:string can never succeed") when opening a form. It occurs when writing "xxforms:my-data()//bar" as calculate in a binding, casting to a string helps ("string(xxforms:my-data()//bar)") but wasn't needed before.

Can somebody explain why I get this error in 3.9 but not in 3.8? For more details please have a look at https://gist.github.com/b395e52cd5329c5de1e9 .

Thank you very much!
Reply | Threaded
Open this post in threaded view
|

Re: XPathException for custom xpath function in 3.9

Erik Bruchez
Administrator
Iacco,

This might be because now use the semantic of xs:string() instead of
string(), see:

https://github.com/orbeon/orbeon-forms/blob/master/src/java/org/orbeon/oxf/util/XPathCache.java#L290

Also, your function registration with Saxon has the following return type:

Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO

This could cause issues with Saxon because it doesn't match what the
function actually returns. If your function can return a number of
nodes, change to:

Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE

-Erik

On Thu, Jun 30, 2011 at 9:27 AM, lacco <[hidden email]> wrote:

> Hi!
>
> I have written a custom xpath function to access a complex data instance in
> a more elegant way (as a shortcut). This function has been working fine in
> Orbeon 3.8, but after upgrading to Orbeon 3.9, I get an XPathException
> ("org.orbeon.saxon.trans.XPathException: Casting from element(bar,
> xs:anyType) to xs:string can never succeed") when opening a form. It occurs
> when writing "xxforms:my-data()//bar" as calculate in a binding, casting to
> a string helps ("string(xxforms:my-data()//bar)") but wasn't needed before.
>
> Can somebody explain why I get this error in 3.9 but not in 3.8? For more
> details please have a look at https://gist.github.com/b395e52cd5329c5de1e9 .
>
> Thank you very much!
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/XPathException-for-custom-xpath-function-in-3-9-tp3636181p3636181.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XPathException for custom xpath function in 3.9

lacco
So you don't think that I can solve this issue without editing the forms I have created?
Reply | Threaded
Open this post in threaded view
|

Re: Re: XPathException for custom xpath function in 3.9

Erik Bruchez
Administrator
Iacco,

Probably not!

-Erik

On Mon, Jul 4, 2011 at 8:10 AM, lacco <[hidden email]> wrote:

> So you don't think that I can solve this issue without editing the forms I
> have created?
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/XPathException-for-custom-xpath-function-in-3-9-tp3636181p3643846.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: XPathException for custom xpath function in 3.9

lacco
StaticProperty.ALLOWS_ZERO_OR_MORE did the trick, thank you very much!
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: XPathException for custom xpath function in 3.9

Erik Bruchez
Administrator
Iacco,

Great to hear that!

-Erik

On Mon, Jul 25, 2011 at 8:29 AM, lacco <[hidden email]> wrote:

> StaticProperty.ALLOWS_ZERO_OR_MORE did the trick, thank you very much!
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/XPathException-for-custom-xpath-function-in-3-9-tp3636181p3693108.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws