Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Xpath that returns numeric values

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Christophe Marchand <christophe.marchand AT axyus.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Xpath that returns numeric values
  • Date: Fri, 24 Feb 2012 08:24:06 +0100

That's what I've done.
Thanks Elliotte

Le 23/02/2012 18:21, Elliotte Rusty Harold a écrit :
On Wed, Feb 22, 2012 at 12:30 PM, Christophe Marchand
<christophe.marchand AT axyus.com> wrote:
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 ?
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.







Archive powered by MHonArc 2.6.24.

Top of Page