[jdom-interest] JDOM Beta 9 - List set problem

Alex Rosen arosen at novell.com
Thu Oct 2 14:20:38 PDT 2003


It looks like it should work... Could you provide a standalone test case
that demonstrates the problem?

Alex

>>> Alves Licinio S NPRI <AlvesLS at Npt.NUWC.Navy.Mil> 9/25/2003 4:13:47
PM >>>
With JDOM Beta 8, I could get a List of elements, then set by index a
new element.
Now with Beta 9, it doesn't seem to get properly set.
I've verified this by going back and fourth with different versions of
JDOM, but the same source code.
 
e.g.
Element partlist_element = root.getChild("PartList");
List partlist = partlist_element.getChildren("Part");
//... I search partlist for the index of the old element I want
replaced
//... I generate it's new replacement, new_part_element
// then I try to add it... replacing my old element
partlist.set(index, new_part_element);
// the above no longer seems to set the new_part_element (and it's
sub-elements)
 
// a temp fix that works for JDOM Beta 9 is (but it shouldn't be
required)
    partlist_element.setContent(partlist);
OR using deprecated methods
    partlist_element.removeChildren();
    partlist_element.setChildren(partlist);
 
//... then I write the tree back out to my XML file
 
 
 
v/r,
Licinio "Lou" Alves 
Email: AlvesLS at Npt.NUWC.Navy.mil 

 



More information about the jdom-interest mailing list