1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
public static Element getElementRec(Element baseElement, String name){
Element result;
if(baseElement == null || name.equals(""))
return null;
try{
if(baseElement.getChild(name) != null)
result = baseElement.getChild(name);
else{
boolean foundElement = false;
result = null;
Iterator i = baseElement.getChildren().iterator();
while(!foundElement && i.hasNext()){
result = getElementRec((Element)i.next(), name);
if(result != null)
foundElement = true;
}
}
}
catch(Exception e){
}
return result;
} |
Partager