Java XPath Evaluate evaluateXpath(Document doc, String xpath, QName returnType)

Here you can find the source of evaluateXpath(Document doc, String xpath, QName returnType)

Description

evaluate Xpath

License

LGPL

Declaration

public static Object evaluateXpath(Document doc, String xpath, QName returnType)
            throws XPathExpressionException 

Method Source Code

//package com.java2s;
/*//from w w w  . j  a v a 2  s. c om
 * JFox - The most lightweight Java EE Application Server!
 * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
 *
 * JFox is licenced and re-distributable under GNU LGPL.
 */

import javax.xml.namespace.QName;

import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;

public class Main {
    private final static XPathFactory xpf = XPathFactory.newInstance();

    public static Object evaluateXpath(Document doc, String xpath, QName returnType)
            throws XPathExpressionException {
        XPath path = xpf.newXPath();
        return path.evaluate(xpath, doc, returnType);
    }
}

Related

  1. evaluateAsString(String expression, Node node)
  2. evaluateNodeListTextXPath(final Document document, final String expression)
  3. evaluateNodeListXPath(final Document document, final String expression)
  4. evaluateNodes(final XPathExpression xpathExpression, final Document pom)
  5. evaluateNodeSet(XPathExpression xpe, Object item)
  6. evaluateXPath(Element element, String xpathstring)
  7. evaluateXpath(Element from, String xpath)
  8. evaluateXPath(final String xPath, final Object item, final QName returnType)
  9. evaluateXPath(final XPathExpression expr, final Object rootNode, final QName returnType)