/**
* This returns the node that is a child of the specified parent that has the specified 'name' and an attribute with
* the specified value. This is similar to the below getChild, but this requires a specific tag name.
*/
public static Element getChild(Element parent, String tagName, String attribute, String attributeValue) {
Element childElement = null;
Iterator iterator = parent.elements(tagName).iterator();
while (iterator.hasNext() && childElement == null) {
childElement = (Element) iterator.next();
String actualValue = childElement.attributeValue(attribute);
if (!attributeValue.equals(actualValue)) {
childElement = null;
}
}
return childElement;