Grazie lo stesso, ho risolto!
Vi posto il codice cosi potrebbe essere utile a qualche altra persona.
codice:
public void readFile(String fileName){
try{
if(_configDoc == null) {
parse(fileName);
}
NodeList restaurants = (NodeList)XPathAPI.selectNodeList(_configDoc.getDocumentElement(), RESTAURANT);
System.out.println("Length " + restaurants.getLength());
for(int i=0;i<restaurants.getLength();i++) {
Node node = restaurants.item(i);
if(node.hasChildNodes()) {
NodeList child = node.getChildNodes();
for(int k=0;k<child.getLength();k++) {
Node aNode = child.item(k);
if(aNode.getNodeName().equals(NAME)
|| aNode.getNodeName().equals(RID)
|| aNode.getNodeName().equals(POSTCODE)
|| aNode.getNodeName().equals(LINK)){
System.out.println("Name : " + aNode.getNodeName()+ " Value : " + getNodeValue(aNode));
}
}
}
}
}catch(Exception e){
System.out.println("E : " + e.getMessage());
}
}
public String getNodeValue(Node node) {
StringBuffer buf = new StringBuffer();
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node textChild = children.item(i);
if (textChild.getNodeType() != Node.TEXT_NODE) {
System.err.println("Mixed content! Skipping child element " + textChild.getNodeName());
continue;
}
buf.append(textChild.getNodeValue());
}
return buf.toString();
}
}