Java XML Element Get getElement(Element e, String name)

Here you can find the source of getElement(Element e, String name)

Description

get Element

License

Open Source License

Declaration

public static String getElement(Element e, String name) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Element;

public class Main {
    public static String getElement(Element e, String name) {
        if (e.getElementsByTagName(name) == null)
            return "";
        if (e.getElementsByTagName(name).item(0) == null)
            return "";
        return e.getElementsByTagName(name).item(0).getTextContent();
    }/*  www. ja v a 2  s. c o  m*/
}

Related

  1. getElement(Document doc, String path)
  2. getElement(Document pDocument, String psTagName, int index)
  3. getElement(Element config, String elementName)
  4. getElement(Element config, String elementName)
  5. getElement(Element e, String localName)
  6. getElement(Element e, String nsUri, String localName)
  7. getElement(Element el, String label)
  8. getElement(Element el, String tagName, int index)
  9. getElement(Element el, String... path)