[jdom-interest] iterative addChild
Paul Madsen
paul.madsen at coventus.com
Fri Oct 6 10:22:08 PDT 2000
I'm trying to iterate through an elements children, adding children as I
go between each existing child and the following one.
When I try:
Element events = root.getChild("events");
List eventslist = events.getChildren("event");
Iterator iterator = eventslist.iterator();
while (iterator.hasNext()) {
Object o = iterator.next();
Element e_event = (Element) o;
Element fillevent = new Element("fillevent");
events.addChild(fillevent);
}
I get a result tree that looks like
events
|____ event
|____ event
|____ event
|____ fillevent
|____ fillevent
|____ fillevent
rather than
events
|____ event
|____ fillevent
|____ event
|____ fillevent
|____ event
|____ fillevent
Will the iterator traverse the original tree or try to account for the
new elements as they are added?
thanks for any tips.
--
Paul Madsen
Coventus Intuitive Networks
340 Terry Fox Drive, Kanata, On, Ca
K2K 3A2
e) paul.madsen at coventus.com
p) (613) 271-0180 x296
More information about the jdom-interest
mailing list