ciao ragazzi
ho un file xml strutturato così
io generalmente mi limitavo a leggerli con un solo nodocodice:<valore1> <valore2> <valore3> <valore4> <valore5> <valore6> <tag></tag> <numero></numero> <nome></nome> </valore6> </valore5> </valore4> </valore3> </valore2> </valore1>
ora come faccio ad arrivare fino in fondo per estrarre i 3 valori?
codice:List list2=rootNode.getChildren("valore1"); for (int k = 0; k < list2.size(); k++) { Element node = (Element) list2.get(k); System.out.println("tag Name : " + node.getChildText("tag")); System.out.println("number: " + node.getChildText("numero")); System.out.println(" Name : " + node.getChildText("nome")); }

Rispondi quotando