Java XML Node Local Name matchingLocalName(Node node, String requiredLocalName)

Here you can find the source of matchingLocalName(Node node, String requiredLocalName)

Description

matching Local Name

License

Apache License

Parameter

Parameter Description
node a parameter
requiredLocalName a parameter

Return

true if the required local name is null or if the nodes local name matches.

Declaration

private static boolean matchingLocalName(Node node, String requiredLocalName) 

Method Source Code

//package com.java2s;
/*/* w ww . ja v a  2 s. c  om*/
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.w3c.dom.Node;

public class Main {
    /**
     * @param node
     * @param requiredLocalName
     * @return true if the required local name is <code>null</code> or if the
     * nodes local name matches.
     */
    private static boolean matchingLocalName(Node node, String requiredLocalName) {
        if (requiredLocalName == null) {
            return true;
        } else {
            String localName = node.getLocalName();
            return requiredLocalName.equals(localName);
        }
    }
}

Related

  1. getLocalName(Node node)
  2. getNodeLocalName(Node node)
  3. getNodeRecursive(Node node, String localName)
  4. isA(Node e, String ns, String localname)
  5. matchingLocalName(Node node, String requiredLocalName)