Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; public class Main { public static String getElementFirstText(Element ele) { Node n = ele.getFirstChild(); if (n instanceof Text) { return ((Text) n).getNodeValue(); } else { return null; } } }