commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Pannier" <>
Subject [JXPath] Use of contexts/variables
Date Fri, 21 Feb 2003 23:44:00 GMT

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

View raw message