Here you can find the source of getContentText(Node n)
public static String getContentText(Node n)
//package com.java2s; //License from project: LGPL import org.w3c.dom.*; public class Main { public static String getContentText(Node n) { if (n == null) return null; if (n.getFirstChild() == null) { return ""; }/*from ww w .j a v a 2 s.c o m*/ return n.getFirstChild().getNodeValue(); } }