src/org/nutz/lang/Xmls.java
public static Element getEle(Element ele, String xpath) {
        XPathFactory factory = XPathFactory.newInstance();
        XPath xp = factory.newXPath();
        try {
            XPathExpression expression = xp.compile(xpath);
            return (Element) expression.evaluate(ele, XPathConstants.NODE);
        }
        catch (XPathExpressionException e) {
            throw Lang.wrapThrow(e);
        }

    }
public static Element getEle(Element ele, String xpath) {
        XPathFactory factory = XPathFactory.newInstance();
        XPath xp = factory.newXPath();
        try {
            XPathExpression expression = xp.compile(xpath);
            return (Element) expression.evaluate(ele, XPathConstants.NODE);
        }
        catch (XPathExpressionException e) {
            throw Lang.wrapThrow(e);
        }

    }
public static Element getEle ( Element ele , String xpath ) { XPathFactory factory = XPathFactory . newInstance ( ) ; XPath xp = factory . newXPath ( ) ; try { XPathExpression expression = xp . compile ( xpath ) ; return ( Element ) expression . evaluate ( ele , XPathConstants . NODE ) ; } catch ( XPathExpressionException e ) { throw Lang . wrapThrow ( e ) ; } }
从一个 XML 元素开始，根据一条 XPath 获取一个元素

@param ele
XML 元素
@param xpath
要获取的元素的 XPath
@return 元素，null 表示不存在
从一个 XML 元素开始，根据一条 XPath 获取一个元素