New issue 23 by HaiLeGia: Element.getChildById(String id) is not correct
http://code.google.com/p/minijoe/issues/detail?id=23
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?