delete element from xml file

"meriem bessais" <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
*I want to delete an element from xml-file. this is my code but the file
dosen't change when I test it.*

* *

* *

*public* *static* String supp(){

            *try*{

            *racine*=*document*.getRootElement();

            Element rac=*racine*.getChild("voitures");

               List   listelt = rac.getChildren();

                  *int* ok=1;

               Iterator i = listelt.iterator();

             *while*(i.hasNext()&& ok==1)

           {

               Element courrent = (Element)i.next();

               *if*
(courrent.getAttribute("immatricule").getValue().equals("8345
tU 125")){

                   System.*out*.println(" "+courrent.getAttribute(
"immatricule").getValue());

                     //Element free = (Element)courrent.detach();

                    System.*out*.println(rac.getName());



                    rac.removeContent(courrent);

                     ok=0;

                     //courrent.removeChild(couleur);

                     System.*out*.println("supprimé");

               }



           }}*catch*(Exception e){*return* e.getMessage();}

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.