Erlang/OTP Forums

Author Message

<  Erlang  ~  Scalar XPath expressions in xmerl

john watson
Posted: Fri Jul 04, 2008 10:04 am Reply with quote
Joined: 04 Jul 2008 Posts: 4 Location: London
I'm having difficulty in getting the xmerl Xpath module to recognize functions that return scalar expressions (as opposed to node sets). AFIK, the main production in the XPath 1.0 grammar is the expression and the small XPath expressions in the sample are syntactically correct. Can anybody offer advice?
View user's profile Send private message
francesco
Posted: Tue Jul 08, 2008 1:31 pm Reply with quote
User Joined: 07 Jul 2006 Posts: 249 Location: London
The shortcut @ is not supported in XMERL if I'm not mistaken. Have you tried using the full 'attribute' axis spec in your test (as per sec 2.2 of the XPath 1.0)?
View user's profile Send private message Visit poster's website
john watson
Posted: Tue Jul 08, 2008 2:52 pm Reply with quote
Joined: 04 Jul 2008 Posts: 4 Location: London
Thanks, Francesco. However the simple attribute expression /code/@cd1 does work which has the shortcut, and the error I'm seeing appears to me to be a problem parsing the function name.

Your answer worries me a little because the xmerl documentation says The xmerl_xpath module handles the entire XPath 1.0 spec
View user's profile Send private message
martin
Posted: Wed Jul 09, 2008 11:08 am Reply with quote
User Joined: 06 Aug 2006 Posts: 11
Sorry, it was my reply, that by mistake came up under Francesco due to the URL including the sessionid Smile

Anyway, i must have recalled wrong or possibly used a pre OTP release. But as you point out it does not seem to support the core functions specified in the spec at all.
View user's profile Send private message
john watson
Posted: Fri Jul 11, 2008 8:16 am Reply with quote
Joined: 04 Jul 2008 Posts: 4 Location: London
OK - thanks again, then, Martin.

So - if it's true that support for functions in xmerl's XPath needs mending, what's the process for requesting this? I take it that Ericsson look after the libraries.

I have a couple of projects I'd like to start using erlang for, but both require XPath to be solid.
View user's profile Send private message
john watson
Posted: Fri Aug 15, 2008 8:56 am Reply with quote
Joined: 04 Jul 2008 Posts: 4 Location: London
I've now had an initial response from Ericsson indicating that this is indeed a bug.
View user's profile Send private message
bertil
Posted: Fri Aug 22, 2008 2:00 pm Reply with quote
Joined: 22 Aug 2008 Posts: 3
Hi

What would be the most appropriate return result of an XPath scalar expression?
Until now xmerl_xpath:string only returns a node-set (a list of objects). According to XPath an expression also can evaluate to a scalar value; string | number | boolean. Introducing this will break the style of the return value. I have two alternative solutions in mind: 1) Return the scalar values as is or 2) encapsulate it in a record. The second solution would be easier to distinguish from the present return value.
What would be best for real Use Cases?

/Bertil OTP-team
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum