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 javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.NodeList;

public class Main {
    public static NodeList evalXpath(String xpath, Object item) throws XPathExpressionException {
        XPath xp = XPathFactory.newInstance().newXPath();
        XPathExpression expr = xp.compile(xpath);
        return (NodeList) expr.evaluate(item, XPathConstants.NODESET);
    }
}