Re: [xml] xmlXPathStringEvalNumber vs. atof

Looking at XPath 1.0, it does look like scientific notation is not allowed by the standard.

In xpath.c it says:

 * xmlXPathStringEvalNumber:
 * @str:  A string to scan
 *  [30a]  Float  ::= Number ('e' Digits?)?
 *  [30]   Number ::=   Digits ('.' Digits?)?
 *                    | '.' Digits
 *  [31]   Digits ::=   [0-9]+
 * Compile a Number in the string
 * In complement of the Number expression, this function also handles
 * negative values : '-' Number.
 * Returns the double value.
xmlXPathStringEvalNumber(const xmlChar *str) {

Is that [30a] from some addendum to XPath 1.0 or is it a libxml extension?


----- "Bjoern Hoehrmann" <derhoermi gmx net> wrote:

* Christopher R. Palmer wrote:
<xsl:value-of select="0.09 = .9e-1"/>

In XPath 1.0 that is illegal syntax; it is legal syntax in XPath 2.0
which libxml2 does not support. Whether the specifications require
the expression above to evaluate to true I am not sure. XPath 1.0 has
specific requirements for parsing its numeric literals.
BjÃrn HÃhrmann  mailto:bjoern hoehrmann de Â
Am Badedeich 7 Â Telefon: +49(0)160/4415681 Â
25899 DagebÃll  PGP Pub. KeyID: 0xA4357E78 Â

Christopher R. Palmer                     palmer vivisimo com
Chief Technology Officer        
Vivisimo, Inc.                            412-422-2499 ext. 118

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]