Java XML Node Compare isNodeInNS(Node nodeToCompare, String nsuri, String tagName)

Here you can find the source of isNodeInNS(Node nodeToCompare, String nsuri, String tagName)

Description

__UNDOCUMENTED__

License

BSD License

Parameter

Parameter Description
nodeToCompare __UNDOCUMENTED__
nsuri __UNDOCUMENTED__
tagName __UNDOCUMENTED__

Return

__UNDOCUMENTED__

Declaration

public static boolean isNodeInNS(Node nodeToCompare, String nsuri, String tagName) 

Method Source Code


//package com.java2s;
/*//from www .  j  a v a  2 s  .  c o m
 * Copyright (c) 2012. betterFORM Project - http://www.betterform.de
 * Licensed under the terms of BSD License
 */

import org.w3c.dom.*;

public class Main {
    /**
     * __UNDOCUMENTED__
     *
     * @param nodeToCompare __UNDOCUMENTED__
     * @param nsuri         __UNDOCUMENTED__
     * @param tagName       __UNDOCUMENTED__
     * @return __UNDOCUMENTED__
     */
    public static boolean isNodeInNS(Node nodeToCompare, String nsuri, String tagName) {
        String ntcnsuri = nodeToCompare.getNamespaceURI();

        if ((ntcnsuri != null) && (ntcnsuri.length() > 0)) {
            return (tagName.equals(nodeToCompare.getLocalName()) && ntcnsuri.equals(nsuri));
        } else {
            return (tagName.equals(nodeToCompare.getNodeName()));
        }
    }
}

Related

  1. compareStringNode(Node node, String tag)
  2. compareTwoNodes(Node m, Node n)
  3. equalNode(Node nodeA, Node nodeB)
  4. equals(Node n1, Node n2)
  5. isDescendant(Node testNode, Node compareToNode)
  6. isNodeSame(org.w3c.dom.Node node1, org.w3c.dom.Node node2)