Re: [xml] XPath question w/ libxml2
- From: Daniel Veillard <veillard redhat com>
- To: Mark_Vakoc peoplesoft com
- Cc: xml gnome org
- Subject: Re: [xml] XPath question w/ libxml2
- Date: Thu, 15 Apr 2004 16:08:33 -0400
On Thu, Apr 15, 2004 at 12:08:06PM -0600, Mark_Vakoc peoplesoft com wrote:
This is really an XPath question: have read the XPath 1.0 spec and am
not clear on the proper behavior for a predicate when NaN is used in an
expression such as:
node[number('NaN')]
libxml2 appears to evaluate this predicate as all nodes, whereas I would
have thought it would match zero nodes. Is this behavior defined?
Dixit section 2.4 Predicates:
"A PredicateExpr is evaluated by evaluating the Expr and converting
the result to a boolean. If the result is a number, the result will
be converted to true if the number is equal to the context position
and will be converted to false otherwise"
So I agree it sounds like this should select no node.
The difference though is that at least on my platform this works as
expected:
paphio:~/XML -> xmllint --shell tst.xml
/ > xpath doc[1]
Object is a Node Set :
Set contains 1 nodes:
1 ELEMENT doc
/ > xpath doc[number('NaN')]
Object is a Node Set :
Set contains 0 nodes:
/ >
I'm afraid you might be seeing some weird floating point troubles.
Can you try to see if the basic tests from test/XPath/expr/floats
work correctly first ? Then it might be number('NaN') failing or
the index tests.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]