Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static NodeList getNodes(Node doc, String xpath_url) throws XPathExpressionException {
        XPathFactory xpathFactory = XPathFactory.newInstance();
        return (NodeList) xpathFactory.newXPath().compile(xpath_url).evaluate(doc, XPathConstants.NODESET);
    }
}