commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tahir Akhtar" <ta...@spectrum-tech.com>
Subject RE: [JXPath] Evaluating expressions with simple arithmetic expression
Date Tue, 04 Apr 2006 08:39:59 GMT
Thanks.
It worked.

-----Original Message-----
From: Dmitri Plotnikov [mailto:dmitri@apache.org] 
Sent: Saturday, April 01, 2006 1:24 AM
To: Jakarta Commons Users List
Subject: Re: [JXPath] Evaluating expressions with simple arithmetic
expression

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
 




-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 3/31/2006
 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message