Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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 {
            return (NodeList) xpath.evaluate(nodePath, inputSource, XPathConstants.NODESET);
        } catch (XPathExpressionException e) {
            return null;
        }
    }
}