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

import org.w3c.dom.Document;

import org.w3c.dom.NodeList;

public class Main {
    /**
     *  convenience method to evaluate an xpath expression against a DOM document
     * @param DOM the document
     * @param xpath the xpath
     * @return NodeList of retrieved nodes
     * @throws XPathExpressionException
     */
    public static NodeList evaluateXPath(Document DOM, XPathExpression xpath) throws XPathExpressionException {

        NodeList result = (NodeList) xpath.evaluate(DOM, XPathConstants.NODESET);

        return result;
    }
}