commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joern turner <joern.tur...@web.de>
Subject [jxpath] problem with predicates
Date Wed, 18 Feb 2004 21:16:36 GMT
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message