Example usage for org.apache.commons.jxpath.ri.compiler TreeCompiler TreeCompiler

List of usage examples for org.apache.commons.jxpath.ri.compiler TreeCompiler TreeCompiler

Introduction

In this page you can find the example usage for org.apache.commons.jxpath.ri.compiler TreeCompiler TreeCompiler.

Prototype

TreeCompiler

Source Link

Usage

From source file:org.chiba.xml.xpath.impl.JXPathReferenceFinderImpl.java

/**
 * Returns the set of all references to other nodes contained in the given
 * XPath expression.//from   w ww .ja v  a  2s  .  c  o  m
 *
 * @param xpath the XPath expression.
 * @return the set of all references to other nodes.
 * @throws XFormsException if a reference detection error occurred.
 */
public Set getReferences(String xpath) throws XFormsException {
    try {
        if (this.compiler == null) {
            this.compiler = new TreeCompiler();
        }

        Object expression = Parser.parseExpression(xpath, this.compiler);
        Map references = new HashMap();
        addExpressionReferences(references, null, (Expression) expression);

        return references.keySet();
    } catch (Exception e) {
        throw new XFormsException(e);
    }
}