You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Steve Pannier <St...@jacada.com> on 2003/02/22 00:44:00 UTC

[JXPath] Use of contexts/variables

Dmitri,

Here's a new question for you.

Our product allows the user to include any number of
"variables" in their xpath expression.  These are not
xpath variables, but rather variables they define in our
design time framework.  The user is free to define the
type for each variable, and they can define structure
types.  Each variable's data is contained in a Map
hidden in a subclass of the variable.  Now, when they
provide an xpath expression, we allow them to include
any number of these variables they choose to.  So, in
order to allow us to evaluate these expressions without
having to first parse the expression, we decided to create
a root context of NULL, and then add each variable's
data map to the context as an xpath variable.  The result
of this is, if the user has a variable named "Var1", they
must reference it in their expression as "$Var1/Var1".

We would rather the user not have to use this syntax in
expressions for referencing variables.  We are talking
about allowing them to simply use "$Var1" in their
expression.  Then before evaluating the expression we
would substitute the "$Var1" with "$Var1/Var1".  This
would require us to either write our own pre-parser, or
somehow make use of JXPath code to do this.  But, I'm
curious if there's any other way to attack this.  Maybe
by defining the context differently.  Any ideas?

Let me know if the above explanation of what we're
trying to do is not clear.


Steve Pannier
Jacada, Inc.
(763) 201-0002 Ext. 219
spannier@jacada.com
http://www.jacada.com



[Jelly] Setting array properties

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
I've got several properties in an bean which are double[] properties, 
what would be the best way to set the value of these properties in Jelly?

ie I have methods which look like

public void setProp(double[] array){
....
}

So, I need it instantiate the double[] and then pass it into the method. 
I've looked at the new/set tags, but I'm unsure how to fill the contents 
of the arrays. So far I suspect my only alterative is to use something 
like bsf / beanshell tags to accomplish this.

-thanks
Mark





Re: [JXPath] Use of contexts/variables

Posted by Dmitri Plotnikov <dp...@yahoo.com>.
Steve,

This is an easy one.  In JXPath Variables is an interface - you are
free to provide your own implementation and install it on JXPathContext
by calling context.setVariables().  It is a very simple interface and
you won't have any trouble meeting your requirement.

I hope this helps.

- Dmitri


--- Steve Pannier <St...@jacada.com> wrote:
> Dmitri,
> 
> Here's a new question for you.
> 
> Our product allows the user to include any number of
> "variables" in their xpath expression.  These are not
> xpath variables, but rather variables they define in our
> design time framework.  The user is free to define the
> type for each variable, and they can define structure
> types.  Each variable's data is contained in a Map
> hidden in a subclass of the variable.  Now, when they
> provide an xpath expression, we allow them to include
> any number of these variables they choose to.  So, in
> order to allow us to evaluate these expressions without
> having to first parse the expression, we decided to create
> a root context of NULL, and then add each variable's
> data map to the context as an xpath variable.  The result
> of this is, if the user has a variable named "Var1", they
> must reference it in their expression as "$Var1/Var1".
> 
> We would rather the user not have to use this syntax in
> expressions for referencing variables.  We are talking
> about allowing them to simply use "$Var1" in their
> expression.  Then before evaluating the expression we
> would substitute the "$Var1" with "$Var1/Var1".  This
> would require us to either write our own pre-parser, or
> somehow make use of JXPath code to do this.  But, I'm
> curious if there's any other way to attack this.  Maybe
> by defining the context differently.  Any ideas?
> 
> Let me know if the above explanation of what we're
> trying to do is not clear.
> 
> 
> Steve Pannier
> Jacada, Inc.
> (763) 201-0002 Ext. 219
> spannier@jacada.com
> http://www.jacada.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/