Java XML Element Get by Name getElementByTagName(Element parent, String elementName)

Here you can find the source of getElementByTagName(Element parent, String elementName)

Description

get Element By Tag Name

License

Open Source License

Declaration

public static final Element getElementByTagName(Element parent, String elementName) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Element;

import org.w3c.dom.NodeList;

public class Main {
    public static final Element getElementByTagName(Element parent, String elementName) {
        NodeList nodeList = parent.getElementsByTagName(elementName);

        if (nodeList.getLength() > 0) {
            return (Element) nodeList.item(0);
        }//  ww w .  j  a v  a2s  .  c om

        return null;
    }
}

Related

  1. getElementByTag(HTMLDocument htmlDoc, int offset, Tag tag)
  2. getElementByTagAndName(Document document, String tagName, String elementName)
  3. getElementByTagName(Document doc, String eleName)
  4. getElementByTagName(Document document, String tagName)
  5. getElementByTagName(Element aParent, String aName)
  6. getElementByTagName(Element parent, String elementName)
  7. getElementByTagNameWithParents(Element n, String... elementName)
  8. getElementDateValue(Document document, Element parent, String string)
  9. getElementFloatValue(Document document, Element parent, String element)