Il metodo java che non mi legge il valore di un nodo è questo :
codice:
public void readFile(String fileName){
try{
if(_configDoc == null) {
parse(fileName);
}
NodeList restaurants = (NodeList)XPathAPI.selectNodeList(_configDoc.getDocumentElement(), RESTAURANT);
for(int i=0; i<restaurants.getLength(); i++) {
Node pub = restaurants.item(i);
if(pub.hasChildNodes()) {
NodeList child = pub.getChildNodes();
System.out.println("CHILD : " + child.getLength());
for(int g = 0; g < child.getLength(); g++ ){
Node aNode = child.item(g);
if(aNode.getNodeType() != Node.TEXT_NODE){
System.out.println("Name : " + aNode.getNodeName() + " Value : " + aNode.getNodeValue());
}
}
}
}
}catch(Exception e){
System.out.println("E : " + e.getMessage());
}
}
mentre il codice xml è il seguente :
Il problema è che ricevo sempre valore null dal metodo .getNodeValue e non riesco a capire qual'è il problema.
Dovè che ho sbagliato ?