Example usage for org.apache.commons.jxpath CompiledExpression iterate

List of usage examples for org.apache.commons.jxpath CompiledExpression iterate

Introduction

In this page you can find the example usage for org.apache.commons.jxpath CompiledExpression iterate.

Prototype

Iterator iterate(JXPathContext context);

Source Link

Document

Traverses the xpath and returns a Iterator of all results found for the path.

Usage

From source file:blueprint.sdk.util.JXPathHelper.java

/**
 * @param expr XPath to evaluate/*w  w w .java2s  . c  o  m*/
 * @param context target context, JXPathContext.newContext(Node)
 * @return Iterator or null(not found)
 */
@SuppressWarnings({ "unchecked", "WeakerAccess" })
public static Iterator<String> evaluateIterator(CompiledExpression expr, JXPathContext context) {
    Iterator<String> result = null;

    try {
        result = expr.iterate(context);
    } catch (JXPathNotFoundException ignored) {
    }

    return result;
}