[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-user
Subject:    Re: [JXPath] Evaluating expressions with simple arithmetic expression
From:       Dmitri Plotnikov <dmitri () apache ! org>
Date:       2006-03-31 20:23:39
Message-ID: 20060331202339.24871.qmail () web36412 ! mail ! mud ! yahoo ! com
[Download RAW message or body]


Tahir,

Try putting a space before the minus.  XPath allows the "-" character in identifiers.

- Dmitri 

----- Original Message ----
From: Tahir Akhtar <tahir@spectrum-tech.com>
To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
Sent: Friday, March 31, 2006 1:44:05 PM
Subject: [JXPath] Evaluating expressions with simple arithmetic expression

Hi,

I have a custom variable pool to a JXPath context.  Variables are named
A1,A2 … B1,B2 … and so on.

 

When I execute following code, I get the expected value.

 

Val=context.getValue("$A1");

 

But I try to evaluate something like this:

 

Val=context.getValue("$B3-$B2");

 

I get JXPath Exception: 

 

org.apache.commons.jxpath.JXPathException: Invalid XPath: '$B3-$B2'. Syntax
error after: '$B'

            at
org.apache.commons.jxpath.ri.Parser.parseExpression(Parser.java:60)

            at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.compileExpression(JX
PathContextReferenceImpl.java:218)

            at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathConte
xtReferenceImpl.java:247)

Most of other expressions like those involving constants "2*2",
sum(expression) are working correctly.

 

 

Is it possible to evaluate expressions like Val=context.getValue("$B3-$B2");
with JXPath

 

 

Waiting for all the helpful comments

 

Regards,

Tahir

 


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/298 - Release Date: 3/30/2006
 





[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic