Ciao ragazzi,
ho questo XML da parsare:

<rooms>
<node name="Pippo">
<node name="Pippo2">
<room population="18">SuperPippo</room>
</node>
</node>
</rooms>

Riesco a leggere il primo nodo ma nn riesco a fare la stessa cosa per i figli.Questo è il codice che ho scritto cosa nn funziona?
NodeList listaCategorie = doc.getElementsByTagName("node");
Node newListaCat = null;
NamedNodeMap attri = null;
Node attributo = null;

for( int i = 0; i < listaCategorie.getLength(); i++ ){

newListaCat = listaCategorie.item(i);
if(newListaCat.hasAttributes() ){
attri = newListaCat.getAttributes();
for( int j = 0; j < attri.getLength(); j++ ){

attributo = attri.item(j);
System.out.println( "Nome attributo: "+ attributo.getNodeValue() );
}

NodeList listaSottoCat = newListaCat.getChildNodes();
for( int g = 0; g < listaSottoCat.getLength(); g++ ){

System.out.println("Sotto Categorie " + listaSottoCat.item(g).getNodeValue());
}

}
}

Grazie
Sara