You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Tahir Akhtar <ta...@spectrum-tech.com> on 2006/04/04 10:39:59 UTC

RE: [JXPath] Evaluating expressions with simple arithmetic expression

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 <ta...@spectrum-tech.com>
To: Jakarta Commons Users List <co...@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