Dmitri Plotnikov wrote:
Joern,yes and thanks for the quick answer. this clarifies some problems i had. actually my testcase wasn't correct which lead to the problems but nevertheless your answer is very helpfull for our understanding.
An attribute pointer (like many other kinds of pointers) holds onto the node it represents and therefore may return a stale value. To get the fresh value you need to do something like this:
Object newValue = context.getValue(pointer.asPath());
I hope this helps.
best,
Joern
- Dmitri
--- joern turner <[EMAIL PROTECTED]> wrote:
hello,
i've got a problem evaluating predicates when used in conjunction
with relative contexts.
here the xml-input i'm using: <people> <person name="Name1"></person> <person name="Name2"></person> <person name="Name3"></person> <person name="Name4"></person> <new name="NameX"></new> </people>
here's the code:
//document is a DOM containing the above xml JXPathContext rootContext = JXPathContext.newContext(document);
//the xpath must be evaluated relative to pointer Pointer pointer = rootContext.getPointer("/people/new/@name"); JXPathContext relativeContext = rootContext.getRelativeContext(this.pointer);
//ok
assertTrue(relativeContext.getPointer("not(//person/@name=.)").getValue().toString().equals("true"));
//fails
this.pointer.setValue("Name1");
assertTrue(relativeContext.getPointer("not(//person/@name=.)").getValue().toString().equals("false"));
i've tried this and that but with no success. can someone shed some light on this or teach me what i'm doing wrong?
thanks,
Joern
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
