public Element getChildById(String id) {
int childCount = this.getChildCount();
Element currChild = null;
for (int i=0; i < childCount; i++) {
if (this.getChildType(i) == this.ELEMENT) {
currChild = this.getElement(i);
if (currChild != null &&
id.equals(currChild.getAttributeValue("id"))
) {
break;
} else if (currChild.getChildCount() > 0) {
currChild.getChildById(id);
}
}
}
return currChild;
}
Above is the current implementation. If there is no child element with the
specified id, the function will traverse through and return the last child. Am
I right?
Original issue reported on code.google.com by HaiLe...@gmail.com on 26 Dec 2010 at 12:35
Original issue reported on code.google.com by
HaiLe...@gmail.com
on 26 Dec 2010 at 12:35