Java XPath Evaluate xPath(final Node aNode, final String anXPath, final QName aQName)

Here you can find the source of xPath(final Node aNode, final String anXPath, final QName aQName)

Description

x Path

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static final <T> T xPath(final Node aNode, final String anXPath, final QName aQName)
            throws XPathExpressionException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.xml.namespace.QName;

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 final XPath xPath = XPathFactory.newInstance().newXPath();

    @SuppressWarnings("unchecked")
    public static final <T> T xPath(final Node aNode, final String anXPath, final QName aQName)
            throws XPathExpressionException {
        return (T) xPath.compile(anXPath).evaluate(aNode, aQName);
    }//from  w  w w  .  ja  va 2 s .  co m
}

Related

  1. executeXPathExpression(Document document, String expression)
  2. execXPath(org.w3c.dom.Node node, String pattern, QName xPathConstantsType)
  3. findNodeAndGetXPath(String qName, String fileName)
  4. getNodesListXpath(final String xPathS, final Node node, final String nsuri, final String pre, final QName returnType)
  5. parseVariable(Node contextNode, String xPathString)
  6. xpathEvalElements(String expr, Object e)
  7. xpathEvalNodes(String expr, Object e)