Affects Version/s: 1.0 Final
Fix Version/s: None
Operating System: All
The reason for this is to allow CompiledExpression objects to be created outside
the context of any bean.
Attached is a refresher conversation I had with Dmitri.
The compilation process itself does not require a context at all. The
only reason the context is involved is that JXPathContext is an
abstract class that allows multiple implementations of JXPath. The
actual implementation, along with the compiler is found dynamically.
I ran into this issue myself when I was writing a Jex-JXPath adapter
(see http://www.plotnix.com/jex/index.html). There I simply created a
static context with null for a context node and was using it for all
I'll add a newContext method without parameters. For that matter I
don't see what would be wrong with an explicit setRootObject(...)
method. I'll add that too.
Could you submit this to Bugzilla so we could track it?
— Ovidiu Predescu <firstname.lastname@example.org> wrote:
> Hi Dmitri,
> I've finally managed to update my code to use your latest 1.0b1
> release of JXPath: really good stuff, and the documentation is very
> nice! Thanks a lot for the hard work you put in this, it's really
> I encountered one small problem with the API. In order to obtain
> CompiledExpression, I need to create a JXPathContext. I want to
> compile the XPath expressions and assign them to some instance
> variables of a class, before I actually use them in my methods. There
> doesn't seem to be a way however to obtain the compiled
> without providing a bean when creating the context. So the current
> code I have reads like this:
> JXPathContext jxpathContext = JXPathContext.newContext(new
> CompiledExpression jxpath_a = jxpathContext.compile("a");
> Would it be possible to eliminate the need to pass a bean context in
> newContext()? I think the API for compiled expressions would be a bit
> cleaner. I can live with it as it is, no problem, it's just that
> be cleaner this way.
|Field||Original Value||New Value|
|Affects Version/s||1.0 Beta 1 [ 12311816 ]|