EvaluationUtils.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:trust-java 作者:
/**
 * Evaluates provided XPath expression into the {@link String}
 *
 * @param evalExpression Expression to evaluate
 * @param xmlSource XML source
 * @return Evaluation result
 */
public static String evaluateXPathToString(String evalExpression,
                                           String xmlSource) {
    try {
        return XPathFactory.
                newInstance().
                newXPath().
                evaluate(
                        evalExpression,
                        DocumentBuilderFactory.
                                newInstance().
                                newDocumentBuilder().
                                parse(new InputSource(
                                        new StringReader(
                                                xmlSource))));
    } catch (Exception e) {
        LOG.warning(COMMON_EVAL_ERROR_MESSAGE);
    }

    return EMPTY;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号