[jdom-interest] remove elements--The underlying xml doesn't change

Ladhani, Dilip dladhani at gltg.com
Tue Jun 18 12:29:58 PDT 2002


 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();
  }
 }




More information about the jdom-interest mailing list