Hi Ray, Use remove() on the iterator The message is correct. You are modifying the collection while the iterator is operating. CME is thrown if any modification is make to the collection other than through the iterator
Mike Skells -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ray Grieselhuber Sent: Tuesday 17 February 2004 17:58 To: [EMAIL PROTECTED] Subject: [dom4j-user] java.util.ConcurrentModificationException Hello, I am trying to remove nodes on a large set of data: while(elementIterator.hasNext()){ Element element = (Element)elementIterator.next(); String name = element.attributeValue("name"); System.out.println(name); if(!dict.containsKey(name)){ System.out.println(name + " is an extra element..."); element.detach(); } } I am getting this error: java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:444) at java.util.AbstractList$Itr.next(AbstractList.java:417) at org.dom4j.tree.FilterIterator.findNext(FilterIterator.java:70) at org.dom4j.tree.FilterIterator.next(FilterIterator.java:45) at perfanalysis.SkinnyFiles.main(SkinnyFiles.java:55) Exception in thread "main" I am using dom4j 1.4. Thanks! Ray ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user