Java tutorial
//package com.java2s; /** * This file belongs to the BPELUnit utility and Eclipse plugin set. See enclosed * license file for more information. */ import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static String getTextContent(Node e) { StringBuilder sb = new StringBuilder(); NodeList children = e.getChildNodes(); if (children != null) { for (int i = 0; i < children.getLength(); i++) { Node n = children.item(i); if (n.getNodeType() == Node.TEXT_NODE) { sb.append(n.getNodeValue()); } } } return sb.toString(); } }