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

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

Description

Get the Text value

License

Apache License

Parameter

Parameter Description
element a parameter
tagName a parameter

Return

String value

Declaration

public static String getTextValue(Element element, String tagName) 

Method Source Code

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

import org.w3c.dom.Element;

public class Main {
    /**//w  w w  . j a v a  2s.  c  o  m
     * Get the Text value
     * @param element
     * @param tagName
     * @return String value
     */
    public static String getTextValue(Element element, String tagName) {
        return element.getElementsByTagName(tagName).item(0).getChildNodes().item(0).getNodeValue().trim();
    }
}

Related

  1. getTextValue(Element ele, String tagName)
  2. getTextValue(Element ele, String tagName)
  3. getTextValue(Element element)
  4. getTextValue(Element element)
  5. getTextValue(Element element, String name)
  6. getTextValue(Element element, String tagName)
  7. getTextValue(Element node)
  8. getTextValue(Element valueEle)
  9. getTextValue(Element valueEle)