Java XML Element Get Value getTextContent(Element ele)

Here you can find the source of getTextContent(Element ele)

Description

get Text Content

License

Open Source License

Declaration

public static String getTextContent(Element ele) 

Method Source Code

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

import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static String getTextContent(Element ele) {
        NodeList list = ele.getChildNodes();
        for (int i = 0; i < list.getLength(); i++) {
            Node node = list.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                return node.getTextContent();
            }// w  w  w  . j  a v a2 s .  c  o m
        }
        return "";
    }
}

Related

  1. getText(final Element element, final StringBuilder sbuf, final boolean decend)
  2. getText(final Element tag)
  3. getTextContent(Element e)
  4. getTextContent(Element e, String name)
  5. getTextContent(Element el)
  6. getTextContent(Element element)
  7. getTextContent(Element element)
  8. getTextContent(Element element)
  9. getTextContent(Element element)