import org.w3c.dom.Node;
public class Utils {
/**
* Search for a named child of a given node
* @param currentNode Starting point for our search
* @param tagName Node name to look up
* @return matching Node (null if none)
*/
public static Node getChildSiblingByName(Node currentNode, String tagName) {
Node node = currentNode.getFirstChild();
while ((node != null) && (!node.getNodeName().equals(tagName))) {
node = node.getNextSibling();
}
return node;
}
}
|