[jdom-interest] getChildren
New, Cecil (GEAE)
cecil.new at ae.ge.com
Mon Dec 16 12:12:13 PST 2002
the java.util.List.add() method adds to the end of the list. But there is
another method that will insert. Per javadocs:
public void add(int index, Object element)
Inserts the specified element at the specified position in this list (optional
operation). Shifts the element currently at that position (if any) and any
subsequent elements to the right (adds one to their indices).
-----Original Message-----
From: Antonello Dell'Armi [mailto:A.Dellarmi at ELIS.ORG]
Sent: Friday, December 13, 2002 4:34 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] getChildren
i have an element accesslist with inside a sequence of instance element.Each
instance consist on 2 different element named watcher and tupleid.
<instance>
<watcher>a</watcher>
<watcher>b</watcher>
<tupleID>1</tupleID>
<tupleID>3</tupleID>
</instance>
My desire is to add a new element watcher. So i do:
List watchers = instance.getChildren("watcher");
Element newatcher = new Element("watcher");
newatcher.setText("c");
watchers.add(newatcher);
but i get:
<instance>
<watcher>a</watcher>
<watcher>b</watcher>
<tupleID>1</tupleID>
<tupleID>3</tupleID>
<watcher>c</watcher>
</instance>
that it's wrong!!!Where i do the mistake?
BRGS
Antonello
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.co
m
More information about the jdom-interest
mailing list