Android XML Document Search getFirstElementByTagName(Document doc, String name)

Here you can find the source of getFirstElementByTagName(Document doc, String name)

Description

get First Element By Tag Name

Declaration

public static Node getFirstElementByTagName(Document doc, String name) 

Method Source Code

//package com.java2s;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static Node getFirstElementByTagName(Document doc, String name) {
        NodeList nodes = doc.getElementsByTagName(name);
        if (nodes != null && nodes.getLength() > 0)
            return nodes.item(0);
        return null;
    }//  ww w.  j  a  v a  2s  .c  om
}

Related

  1. getString(Document doc, String tagName)
  2. getStringDataAsList(Document vastDoc, String elementName)
  3. getStringDataAsList(Document vastDoc, String elementName, String attributeName, String attributeValue)
  4. getInteger(Document doc, String tagName)