Discussion:
[XOM-interest] Xpath that returns numeric values
Christophe Marchand
2012-02-22 17:30:09 UTC
Permalink
Hi !

Element.query("count(//document[@imported])"); throws this exception :
nu.xom.XPathTypeException: XPath expression count(//document[@imported])
returned a java.lang.Double instead of a node-set.
at nu.xom.JaxenConnector.selectNodes(Unknown Source)
at nu.xom.Node.query(Unknown Source)
at nu.xom.Node.query(Unknown Source)

Is there a workaround, or should I use
Element.query("count(//document[@imported])").size() instead ?

Which workaround for avg(...) functions ?

Thanks in advance,
Christophe
Elliotte Rusty Harold
2012-02-23 17:21:31 UTC
Permalink
On Wed, Feb 22, 2012 at 12:30 PM, Christophe Marchand
Post by Christophe Marchand
Hi !
returned a java.lang.Double instead of a node-set.
? ? ? ? at nu.xom.JaxenConnector.selectNodes(Unknown Source)
? ? ? ? at nu.xom.Node.query(Unknown Source)
? ? ? ? at nu.xom.Node.query(Unknown Source)
Is there a workaround, or should I use
Which workaround for avg(...) functions ?
This is working as intended. Java's strict typing really doesn't deal
well with XPath's loose typing. The workaround is to do math in Java
rather than in XPath.
--
Elliotte Rusty Harold
elharo at ibiblio.org
Christophe Marchand
2012-02-24 07:24:06 UTC
Permalink
That's what I've done.
Thanks Elliotte
Post by Elliotte Rusty Harold
On Wed, Feb 22, 2012 at 12:30 PM, Christophe Marchand
Post by Christophe Marchand
Hi !
returned a java.lang.Double instead of a node-set.
at nu.xom.JaxenConnector.selectNodes(Unknown Source)
at nu.xom.Node.query(Unknown Source)
at nu.xom.Node.query(Unknown Source)
Is there a workaround, or should I use
Which workaround for avg(...) functions ?
This is working as intended. Java's strict typing really doesn't deal
well with XPath's loose typing. The workaround is to do math in Java
rather than in XPath.
Loading...