Java XML Node Text Value getText(Node node)

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

Description

get Text

License

Open Source License

Declaration

public static String getText(Node node) 

Method Source Code

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

import org.w3c.dom.*;

public class Main {

    public static String getText(Node node) {
        String text = "";
        NodeList children = node.getChildNodes();
        for (int i = 0; i < children.getLength(); i++) {
            Node child = children.item(i);
            if (child.getNodeType() == Node.TEXT_NODE) {
                text += child.getNodeValue() + " ";
            }/*from   ww  w  . j  a  v a  2 s.c  o m*/
        }
        return text;
    }
}

Related

  1. getText(Node node)
  2. getText(Node node)
  3. getText(Node node)
  4. getText(Node node)
  5. getText(Node node)
  6. getText(Node node)
  7. getText(Node node)
  8. getText(Node node)
  9. getText(Node node)