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