| Author |
Message |
< Erlang ~ Scalar XPath expressions in xmerl |
| john watson |
Posted: Fri Jul 04, 2008 10:04 am |
|
|
|
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? |
|
|
| Back to top |
|
| francesco |
Posted: Tue Jul 08, 2008 1:31 pm |
|
|
|
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)? |
|
|
| Back to top |
|
| john watson |
Posted: Tue Jul 08, 2008 2:52 pm |
|
|
|
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 |
|
|
| Back to top |
|
| martin |
Posted: Wed Jul 09, 2008 11:08 am |
|
|
|
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
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. |
|
|
| Back to top |
|
| john watson |
Posted: Fri Jul 11, 2008 8:16 am |
|
|
|
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. |
|
|
| Back to top |
|
| john watson |
Posted: Fri Aug 15, 2008 8:56 am |
|
|
|
Joined: 04 Jul 2008
Posts: 4
Location: London
|
| I've now had an initial response from Ericsson indicating that this is indeed a bug. |
|
|
| Back to top |
|
| bertil |
Posted: Fri Aug 22, 2008 2:00 pm |
|
|
|
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 |
|
|
| Back to top |
|
|
|