Here you can find the source of getContent(Element xmlElement)
public static String getContent(Element xmlElement)
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /**/*from w w w .j av a2s .c om*/ * Get the content value for the given XML element */ public static String getContent(Element xmlElement) { if (xmlElement == null) { throw new IllegalArgumentException("xmlElement cannot be null"); } StringBuilder content = new StringBuilder(); for (Node childNode = xmlElement.getFirstChild(); childNode != null; childNode = childNode .getNextSibling()) { if (childNode.getNodeType() == Node.TEXT_NODE) { content.append(childNode.getNodeValue()); } } return content.toString(); } }