Java XPath Expression singleXPathNode(String expression, Node node)

Here you can find the source of singleXPathNode(String expression, Node node)

Description

single X Path Node

License

Apache License

Declaration

public static Node singleXPathNode(String expression, Node node)
            throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Node;

public class Main {
    public static Node singleXPathNode(String expression, Node node)
            throws Exception {
        XPath xp = XPathFactory.newInstance().newXPath();
        return (Node) xp.evaluate(expression, node, XPathConstants.NODE);
    }/*www .j av a 2  s  .c o  m*/
}

Related

  1. parseXMLValue(String xml, String xpathExpression)
  2. parseXPath(String expression, NamespaceContext nsContext)
  3. pathExists(XPath xpath, String expression, Object object)
  4. readXmlNodeChildFromFile(String xPath, String path, NamespaceContext nsContext)
  5. replaceXPathNode(Node replaceThis, Node replaceWith)
  6. streamNodes(String xpath, Object node)
  7. string(Node context, String expression)
  8. string(String fileName, String xpathExpression)
  9. valueOf(Node node, String xpath, NamespaceContext context)