]> matita.cs.unibo.it Git - logicplayer.git/blobdiff - server/com/company/xmlOperation.java
New version
[logicplayer.git] / server / com / company / xmlOperation.java
index c4eff71545ad983c2c1eac37d99fc5c56021f390..7a07f93fd66a713d5294b799d490f22ed696d3a6 100644 (file)
@@ -3,7 +3,6 @@ package com.company;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
 
 import org.jdom2.Document;
 import org.jdom2.Element;
@@ -106,16 +105,17 @@ public class xmlOperation {
 
             Document doc = (Document) builder.build(xmlFile);
             Element rootNode = doc.getRootElement();
-
-            for(Element esercizio:rootNode.getChildren())
+            Element tmp = null;
+            for(Element esercizio : rootNode.getChildren())
             {
                 if(esercizio.getText().contentEquals(name))
                 {
-                    System.out.println("trovato");
-                    rootNode.removeContent(esercizio);
+                    tmp=esercizio;
+                    break;
                 }
             }
-
+            if(tmp!=null)
+                rootNode.removeContent(tmp);
             XMLOutputter xmlOutput = new XMLOutputter();
 
             // display nice nice