Java XML Element Get Value getTextValue(Element el, String tagName)

Here you can find the source of getTextValue(Element el, String tagName)

Description

get Text Value

License

Open Source License

Declaration

public static String getTextValue(Element el, String tagName) 

Method Source Code

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

import org.w3c.dom.*;

public class Main {
    public static String getTextValue(Element el, String tagName) {
        String textVal = null;/*from   w w w.j  av a2s  .  c  om*/
        NodeList nl = el.getElementsByTagName(tagName);
        if (nl != null && nl.getLength() > 0) {
            Element e = (Element) nl.item(0);
            textVal = e.getFirstChild().getNodeValue();
        }
        return textVal;
    }
}

Related

  1. getTextOfElement(Element e)
  2. getTexts(Element root, String elementName)
  3. getTextString(Element e)
  4. getTextTrim(Element element)
  5. getTextTrim(Element element)
  6. getTextValue(Element ele, String tagName)
  7. getTextValue(Element ele, String tagName)
  8. getTextValue(Element ele, String tagName)
  9. getTextValue(Element ele, String tagName)