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;
}
}
sources68 the directory containing the programming examples, source code and programming guide online
Wednesday, 3 August 2011
Search for a named child of a given node
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment