Fwd: [jdom-interest] elt.getContent().iterator().remove() - a bug?

Noam Tamim noamt at yahoo.com
Wed Oct 3 13:10:53 PDT 2001


How come I got no replies to this mail?

--- Noam Tamim <noamt at yahoo.com> wrote:
> From: Noam Tamim <noamt at yahoo.com>
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] elt.getContent().iterator().remove() - a
> bug?
> Date: Mon, 1 Oct 2001 11:30:11 -0700 (PDT)
> 
> Hi.
> 
> I am trying to build a util that removes comments from XML files.
> The relevant part is this method:
> 
> static void removeComments(Element e) {
>   Iterator i=e.getContent().iterator();
>   while (i.hasNext()) {
>     Object o=i.next();
>     if (o instanceof Comment) {
>       System.out.println("removing: "+o);
>       i.remove();
>     }
>     else if (o instanceof Element) removeComments((Element)o);
>   }
> }   
> 
> I successfully traverses the whole tree from the given Element
> down
> (as seen by the "removing" line), yet not a single Comment is
> removed.
> Am I doing something wrong, or is that a (known?) bug?
> I looked at the source of Element, PartialList, and LinkedList,
> and
> found no answer.
> Please help me.
> 
> -Noam.


=====
- Noam.

__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1



More information about the jdom-interest mailing list