Code example for Node

Methods: getNodeName

0
     * xmlNode.is("tagName") 
     *  
     * @return True if xmlNode.getNodeName().equals(name), false otherwise. 
     */ 
    public static boolean is(Node node, String name) {
        return node.getNodeName().equals(name);
    } 
 
    /** 
     * xmlNode.depth() 
     *  
     * @return The maximum depth of the node. 
     */ 
    public static int depth(Node node) {
        int maxDepth = 0;
        NodeList list = node.getChildNodes();
        int count = list.getLength();
 
        for (int i = 0; i < count; i++) {
            maxDepth = Math.max(maxDepth, depth(list.item(i)));
        }