[jdom-interest] remove elements--The underlying xml doesn't change
Ladhani, Dilip
dladhani at gltg.com
Tue Jun 18 13:24:26 PDT 2002
I have system.outs everywhere, and I am using JDOM8 beta, the elements are removed from the list (I know this because I do a count before and after) but the changes are not reflecting in the original XML.
Either it's a bug or I am missing a step somewhere????
-----Original Message-----
From: Ladhani, Dilip
Sent: Tue 6/18/2002 3:29 PM
To: jdom-interest at jdom.org
Cc:
Subject: [jdom-interest] remove elements--The underlying xml doesn't change
Here's my code to remove some elements. The elements are removed from the list (I have 17 elements to begin with and I am left with 8, which is correct). The original XML string (it's a string, not a file) is unchanged though, it still has all the 17 elements!! What do I have to do to reflect these changes in the original xml?? I tried doing a dataRs.setContent(null); dataRs.setChildren(listSections ).
That didn't work. Any suggestions??? Thanks
List listSections = dataRs.getChildren("ABC");
Iterator iterSections = listSections.iterator();
while(iterSections.hasNext()){
elemSection = (Element) iterSections.next();
if(elemSection.getChildTextTrim("HDG").equalsIgnoreCase("XYX"){
iterSections.remove();
}
}
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list