Here you can find the source of evaluateXPath(String xpath, Object item, QName returnType)
public static Object evaluateXPath(String xpath, Object item, QName returnType)
//package com.java2s; //License from project: Open Source License import javax.xml.namespace.QName; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; public class Main { public static Object evaluateXPath(String xpath, Object item, QName returnType) { try {//from w w w . j av a 2 s . co m return XPathFactory.newInstance().newXPath().compile(xpath).evaluate(item, returnType); } catch (XPathExpressionException e) { throw new IllegalArgumentException(e); } } }