Here you can find the source of getCharacterData(Element el)
public static String getCharacterData(Element el)
//package com.java2s; import org.w3c.dom.*; public class Main { /** Gets the character data corresponding to the given DOM element. */ public static String getCharacterData(Element el) { Text text = getChildTextNode(el); return text == null ? null : text.getData(); }//from w w w . ja v a 2 s. c om /** * Gets the child text node containing character data * for the given DOM element. */ public static Text getChildTextNode(Element el) { if (el == null) return null; NodeList list = el.getChildNodes(); int size = list.getLength(); for (int i = 0; i < size; i++) { Node node = list.item(i); if (!(node instanceof Text)) continue; return (Text) node; } return null; } }