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.Element;

public class Main {
    /**
     * @param doc
     * @param expr
     * @return
     * @throws XPathExpressionException
     */
    public static Element findElement(Document doc, XPathExpression expr) throws XPathExpressionException {
        Object evaluate = expr.evaluate(doc, XPathConstants.NODE);
        return (Element) evaluate;
    }
}