Java XML Element Get getElementByTagName(Element el, String tag)

Here you can find the source of getElementByTagName(Element el, String tag)

Description

get Element By Tag Name

License

Apache License

Declaration

public static Element getElementByTagName(Element el, String tag) 

Method Source Code

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

import org.w3c.dom.Element;

import org.w3c.dom.NodeList;

public class Main {
    public static Element getElementByTagName(Element el, String tag) {
        NodeList nl = el.getElementsByTagName(tag);
        if (nl.getLength() > 0) {
            return (Element) nl.item(0);
        }/*from w  w  w  .  j  a v  a2s.com*/
        return null;
    }
}

Related

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