Java XML Element Get getElementByTagName(Element element, String name)

Here you can find the source of getElementByTagName(Element element, String name)

Description

get Element By Tag Name

License

Open Source License

Declaration

public static Element getElementByTagName(Element element, String name) 

Method Source Code


//package com.java2s;
// Released under the terms of the CPL Common Public License version 1.0.

import org.w3c.dom.*;

public class Main {
    public static Element getElementByTagName(Element element, String name) {
        NodeList nodes = element.getElementsByTagName(name);
        if (nodes.getLength() == 0)
            return null;
        else// w ww  .j  av a2s . co m
            return (Element) nodes.item(0);
    }
}

Related

  1. getElementByQualifiedName(Element n, String namespace, String elementName)
  2. getElementByTagName(Element current, String name)
  3. getElementByTagName(Element el, String tag)
  4. getElementByTagName(Element el, String tag)
  5. getElementByTagName(Element elem, String name, String emptyValue)
  6. getElementByTagName(Element element, String name, int index)
  7. getElementByTagName(Element element, String tag)
  8. getElementByTagName(Element element, String tag)
  9. getElementByTagName(Element n, String elementName)