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 {
    /**
     * Evaluate xpath.
     * 
     * @param doc
     *            the doc
     * @param expr
     *            the expr
     * @return the object
     */
    public static NodeList evaluateXpath(Document doc, XPathExpression expr) {
        NodeList XmlResult = null;
        try {
            XmlResult = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
        } catch (XPathExpressionException e) {
            e.printStackTrace();
        }
        return XmlResult;
    }
}