Java tutorial
import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; import org.xml.sax.InputSource; public class Main { public static void main(String[] args) throws Exception { InputSource inputSource = new InputSource("input.xml"); XPath xPath = XPathFactory.newInstance().newXPath(); String text = xPath.evaluate("/note/body", inputSource); System.out.println(text); } }