Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] New XPath issue: what to do with non-nodes?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: John Cowan <cowan AT ccil.org>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] New XPath issue: what to do with non-nodes?
  • Date: Thu, 13 Jan 2005 11:17:07 -0500

John Cowan wrote:

Elliotte Harold scripsit:


count(//*) | //*


Thus spake XPath section 3.4:

# An _or_ expression is evaluated by evaluating each operand and
# converting its value to a boolean as if by a call to the _boolean_
# function. The result is true if either value is true and false
# otherwise. The right operand is not evaluated if the left operand
# evaluates to true.



I think you're confusing or expressions with union expressions. An or expression (Production 21) would be

count(//*) or //*

What we've got here is a union expression, production 18. However, I do note that "The | operator computes the union of its operands, which must be node-sets. Predicates are used to filter expressions in the same way that they are used in location paths. It is an error if the expression to be filtered does not evaluate to a node-set" so you're right and this should not be an issue. Jaxen does return list objects containing the union of non-node-sets, but this is an error in Jaxen. I'll report it.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page