1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
/**
* Méthode permettant de retourner ce que contient un noeud
* @param _node le noeud principal
* @param _path suite des noms des noeuds sans espace séparés par des "|"
* @return un string contenant le valeur du noeud voulut
*/
public String readNode(Node _node, String _path) {
String[] paths = _path.split("\\|");
Node node = null;
if (paths != null && paths.length > 0) {
node = _node;
for (int i = 0; i < paths.length; i++) {
node = getChildByName(node, paths[i].trim());
}
}
if (node != null) {
return node.getTextContent();
} else {
return "";
}
} |