commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "liumin HU" <...@sigems.fr>
Subject how it works jxpathcontext removeall?
Date Mon, 31 Dec 2007 11:11:35 GMT
hi everyone,

I use jxpath to manage an ArrayList of bean, the Context is created like: JXPathContext context=JXPathContext.newContext(list);

When I want to delete some objects in the arraylist, i used  context.removeall, but it doesn't
work. 
Before and after call of removeall, the value of count is always 1.

context.getVariables().declareVariable("heure", _h);
System.out.println(context.getValue("count(/.[heureSelected=$heure])"));  ====> 1.0
context.removePath("/.[heureSelected=$heure]");
System.out.println(context.getValue("count(/.[heureSelected=$heure])")); ====> 1.0

I tried too iterator.remove(), i got a exception.
 
Iterator<HeurePrescription> iter = context.iterate("/.[heureSelected=$heure]");
 while(iter.hasNext()){
     iter.next();
     iter.remove();
 }

Any help is appreciated.

Thanks in advance

Liu
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message