Java XPath Expression executePath(final Node node, final XPathExpression expression)

Here you can find the source of executePath(final Node node, final XPathExpression expression)

Description

execute Path

License

Open Source License

Declaration

public static NodeList executePath(final Node node, final XPathExpression expression)
            throws XPathExpressionException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014, 2015 IBH SYSTEMS GmbH.
 * 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
 *
 * Contributors://from   w w w  . j  a v  a2  s.  co m
 *     IBH SYSTEMS GmbH - initial API and implementation
 *******************************************************************************/

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

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static NodeList executePath(final Node node, final XPathExpression expression)
            throws XPathExpressionException {
        return (NodeList) expression.evaluate(node, XPathConstants.NODESET);
    }
}

Related

  1. createXPathExpression(String expression, NamespaceContext namespaceContext)
  2. createXPathExpression(String xpath)
  3. createXPathExpression(String xpathString)
  4. deleteXMLElement(String xml, String xpath)
  5. dumpXpath(Node node, PrintStream printer)
  6. expr(String xpathStr)
  7. extractNode(XPath xpath, String nodePath, String xmlString)
  8. extractNodeList(XPath xpath, String nodePath, String xmlString)
  9. extractNodes(File xmlFile, String xpathLocator)