Java XPath Get getNode(Node node, XPathExpression xpath)

Here you can find the source of getNode(Node node, XPathExpression xpath)

Description

get Node

License

Open Source License

Declaration

public static Node getNode(Node node, XPathExpression xpath) 

Method Source Code


//package com.java2s;
import org.w3c.dom.Node;

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

public class Main {
    public static Node getNode(Node node, XPathExpression xpath) {
        try {/*  w  w  w.  j  a  va 2s  .  c  o m*/
            Object result = xpath.evaluate(node, XPathConstants.NODE);
            return (Node) result;
        } catch (XPathExpressionException e) {
            throw new RuntimeException("Invalid XPath", e);
        }
    }
}

Related

  1. getMessage(XPathExpressionException e)
  2. GetMobivateSessionId()
  3. getNameBasedXPath(Node n, boolean includeCurrent)
  4. getNewXPath()
  5. getNewXPath()
  6. getNode(String xPathExpression, Node node)
  7. getNodeByXPath(Document document, String xPath)
  8. getNodeByXPath(Object context, String expression)
  9. getNodeList(Element root, String xpath)