Java XML Node Text Value get_inner_text(Node node)

Here you can find the source of get_inner_text(Node node)

Description

geinnetext

License

Open Source License

Declaration

public static String get_inner_text(Node node) 

Method Source Code

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

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

public class Main {
    public static String get_inner_text(Node node) {
        NodeList children = node.getChildNodes();
        for (int i = 0; i < children.getLength(); ++i) {
            Node child = children.item(i);
            if (child.getNodeType() == Node.TEXT_NODE)
                return child.getNodeValue();
            if (child instanceof Text)
                return ((Text) child).getData();
            /*if (child instanceof TextNode)
               return ((TextNode)child).getData();*/
        }/*from   w  w  w .  jav  a  2  s  .  c o  m*/
        return null;
    }
}

Related

  1. createNewTextElement(Node elem, String tag, String value)
  2. existNode(Node node, String nodeName, String textValue)
  3. extractNodeText(Node node)
  4. extractText(Node node)
  5. findNodeText(Node node)
  6. getAppInfoText(final Node node)
  7. getContentsOfTextOnlyNode(Node n)
  8. getContentText(Node n)
  9. getDescendentText(Node node, String name)