You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by augusto callejas <ca...@gmail.com> on 2005/03/19 19:36:45 UTC

jxpath >> using variables

hi-

i want to use variables in this way:

 JXPathContext context = JXPathContext.newContext(bean);
 context.getVariables().declareVariable("property", new Integer(2));
 context.setValue("/property", "$property");

that is, i want to reference a variable as part of the value,
not just as part of the reference in a getValue() call.

is this currently not supported?

thanks,
augusto.

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


Re: jxpath >> using variables

Posted by Dmitri Plotnikov <dm...@apache.org>.
Augusto,

Here's how you can do it:

   context.setValue("/property", context.getValue("$property"));

I hope this helps.

- Dmitri


----- Original Message ----- 
From: "augusto callejas" <ca...@gmail.com>
To: <co...@jakarta.apache.org>
Sent: Saturday, March 19, 2005 1:36 PM
Subject: jxpath >> using variables


> hi-
> 
> i want to use variables in this way:
> 
> JXPathContext context = JXPathContext.newContext(bean);
> context.getVariables().declareVariable("property", new Integer(2));
> context.setValue("/property", "$property");
> 
> that is, i want to reference a variable as part of the value,
> not just as part of the reference in a getValue() call.
> 
> is this currently not supported?
> 
> thanks,
> augusto.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 
>


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