This is a utility method that will returns a boolean indicating of the node is XML Element and the name matches the tag passed - Java XML

Java examples for XML:XML Node

Description

This is a utility method that will returns a boolean indicating of the node is XML Element and the name matches the tag passed

Demo Code


//package com.java2s;

import org.w3c.dom.*;

public class Main {
    /**//from w w  w .  j  a  va  2s  . c  o m
     * This is a utility method that will returns a boolean
     * indicating of the node is an Element and the name
     * matches the tag passed
     *
     * @return boolean
     * @param node org.w3c.dom.Node
     * @param tag java.lang.String
     */
    private static boolean isMatchingNode(Node node, String tag) {
        if (node instanceof Element)
            if (node.getNodeName().equals(tag))
                return true;
        return false;
    }
}

Related Tutorials