Java XPath Expression extractNodeList(XPath xpath, String nodePath, String xmlString)

Here you can find the source of extractNodeList(XPath xpath, String nodePath, String xmlString)

Description

extract Node List

License

Open Source License

Declaration

public static NodeList extractNodeList(XPath xpath, String nodePath, String xmlString) 

Method Source Code


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

import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import java.io.StringReader;

public class Main {
    public static NodeList extractNodeList(XPath xpath, String nodePath, String xmlString) {
        InputSource inputSource = new InputSource(new StringReader(xmlString));

        try {/*from w ww  . j a  va  2s .c  om*/
            return (NodeList) xpath.evaluate(nodePath, inputSource, XPathConstants.NODESET);
        } catch (XPathExpressionException e) {
            return null;
        }
    }
}

Related

  1. deleteXMLElement(String xml, String xpath)
  2. dumpXpath(Node node, PrintStream printer)
  3. executePath(final Node node, final XPathExpression expression)
  4. expr(String xpathStr)
  5. extractNode(XPath xpath, String nodePath, String xmlString)
  6. extractNodes(File xmlFile, String xpathLocator)
  7. extractValue(String xml, String xpathExpression)
  8. findElements(final String xPathExpression, final Element root)
  9. hasAnimatedPng(ImageReader reader)