Java XPath Evaluate evaluateXPath(final XPathExpression expr, final Object rootNode, final QName returnType)

Here you can find the source of evaluateXPath(final XPathExpression expr, final Object rootNode, final QName returnType)

Description

evaluate X Path

License

Open Source License

Declaration

public static Object evaluateXPath(final XPathExpression expr, final Object rootNode, final QName returnType) 

Method Source Code

//package com.java2s;
/*/*from  w ww  .  java  2  s  . co m*/
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

import javax.xml.namespace.QName;

import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;

public class Main {
    public static Object evaluateXPath(final XPathExpression expr, final Object rootNode, final QName returnType) {
        try {
            return expr.evaluate(rootNode, returnType);
        } catch (XPathExpressionException e) {
            throw new IllegalStateException("Error while evaluating xpath expression " + expr, e);
        }
    }
}

Related

  1. evaluateNodeSet(XPathExpression xpe, Object item)
  2. evaluateXpath(Document doc, String xpath, QName returnType)
  3. evaluateXPath(Element element, String xpathstring)
  4. evaluateXpath(Element from, String xpath)
  5. evaluateXPath(final String xPath, final Object item, final QName returnType)
  6. evaluateXPath(Node node, String xPath)
  7. evaluateXpath(String expression, Document document, QName dataType)
  8. evaluateXpath(String expression, Object node, QName returnType, NamespaceContext nsContext)
  9. evaluateXPath(String path, Node e, QName type)