Java XML Node Find findNodeByTagName(Document document, String tagName)

Here you can find the source of findNodeByTagName(Document document, String tagName)

Description

find Node By Tag Name

License

Apache License

Declaration

public static Node findNodeByTagName(Document document, String tagName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Document;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static Node findNodeByTagName(Document document, String tagName) {
        Node foundNode = null;/*from   www. j  a  va 2s.  c o m*/
        NodeList nodes = document.getElementsByTagName(tagName);
        if (nodes.getLength() > 0)
            foundNode = nodes.item(0);
        return foundNode;
    }
}

Related

  1. findNode(Node aNode, String aName)
  2. findNode(Node node, String nodeName)
  3. findNode(Node rootNode, String nodeName)
  4. findNodeByAttribute(Document document, String tagName, String attributeName, String attributeValue)
  5. findNodeByName(Document doc, String pathExpression)
  6. findNodeByXpath(org.w3c.dom.Document doc, String xpathEx)
  7. findNodeIndex(Node node)
  8. findNodeIndex(Node node)
  9. findNodeLong(Node node)