Java XPath Get getStringValueByXPath(Node node, String xPath)

Here you can find the source of getStringValueByXPath(Node node, String xPath)

Description

get String Value By X Path

License

Apache License

Declaration

public static String getStringValueByXPath(Node node, String xPath) throws XPathExpressionException 

Method Source Code

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

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

import org.w3c.dom.Node;

public class Main {
    private static XPath path = XPathFactory.newInstance().newXPath();

    public static String getStringValueByXPath(Node node, String xPath) throws XPathExpressionException {
        return path.evaluate(xPath, node);
    }// w  w w .  j  a  va 2 s  . c om
}

Related

  1. getString(Node node, XPathExpression expr)
  2. getStringByXPath(String xml, String xpathStr)
  3. getStringValue(Node node, XPathExpression expression)
  4. getStringValue(Object doc, XPathExpression path)
  5. getStringValue(String targetDoc, String xpathExp, String encoding)
  6. getText(String xPathExpression, Node node)
  7. getTextNodes(Node contextNode, String xPath)
  8. getValidXpath(String xPath, NamespaceContext context)
  9. getValue(final String expression, final String xml)