Hi Erwin I agree with everything you just said...
----- Original Message ----- From: "Erwin Bolwidt" <[EMAIL PROTECTED]> > On Wed, 31 Oct 2001, James Strachan wrote: [snip] > > Together with constructors to match... > > > > VariableContext variables = new SimpleVariableContext( "name", "Here's > > Johnny"); > Hmm.. If you want this, then an addition as proposed below would also > work. > Maybe the method name 'setVariableValue' could be shortened to something > like 'put' :-) I think most people understand what a method with that name > would do. +1 > And that method could return 'this', so you'd be able to write: > > VariableContext context = new SimpleVariableContext().put( "name", "Here's > Johnny" ).put( "town", "Santa Clara" ); +1 Nice! > It would also be nice to have a way of replacing a variable reference with > a literal value in an xpath expression tree. Like: > > XPath xpathArtist = new XPath("//a[@n=$name]"); > xpathArtist.bindVariable( "name", "Here's Johnny" ); > > After that call, the xpath expression will effectively have changed to > "//a[@n=\"Here's Johnny\"]" > > It would speed up the expression, but you cannot set the variable to > something else anymore. Yet sometimes that is exactly what you want. Also nice. Maybe VariableContext interface should have a put() method on it as well as the get() so that XPath.setVariable( "name", "Here's Johnny" ); could under the covers call getVariableContext().put( "name", "Here's Johnny") without the developer having to explicity create a VariableContext etc. Then maybe a different method like bindVariable or replaceVariable() or something could turn the variable expression into a literal value as you suggest. James _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest