Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 70620 invoked from network); 21 Feb 2003 23:39:03 -0000 Received: from atlsmtp.jacada.com (12.166.230.15) by daedalus.apache.org with SMTP; 21 Feb 2003 23:39:03 -0000 Subject: [JXPath] Use of contexts/variables To: commons-user@jakarta.apache.org X-Mailer: Lotus Notes Release 5.0.8 June 18, 2001 Message-ID: From: "Steve Pannier" Date: Fri, 21 Feb 2003 17:44:00 -0600 X-MIMETrack: Serialize by Router on Jacada_Atl_Smtp/CST(Release 5.0.8 |June 18, 2001) at 02/21/2003 06:30:35 PM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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