Example usage for org.apache.commons.jxpath.ri.compiler Path getSteps

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

Introduction

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

Prototype

public Step[] getSteps() 

Source Link

Document

Get the steps.

Usage

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

private Path addSteps(Expression context, Step[] steps, int length) {
    List stepList = new ArrayList();
    if (context instanceof Path) {
        Path path = (Path) context;
        if (path.getSteps() != null) {
            stepList.addAll(Arrays.asList(((Path) context).getSteps()));
        }//  w w  w  .ja  va2s  .c  om
    }
    for (int i = 0; i < length; i++) {
        stepList.add(steps[i]);
    }
    Step[] stepArray = (Step[]) stepList.toArray(new Step[stepList.size()]);

    if (context instanceof LocationPath) {
        LocationPath locationPath = (LocationPath) context;
        return (Path) this.compiler.locationPath(locationPath.isAbsolute(), stepArray);
    }
    if (context instanceof ExpressionPath) {
        ExpressionPath expressionPath = (ExpressionPath) context;
        return (Path) this.compiler.expressionPath(expressionPath.getExpression(),
                expressionPath.getPredicates(), stepArray);
    }
    return (Path) this.compiler.expressionPath(context, null, stepArray);

}

From source file:org.xchain.framework.jxpath.JXPathValidator.java

static void validatePath(Path path, NamespaceContext xmlns) {
    for (Step step : path.getSteps()) {
        validateStep(step, xmlns);/* ww  w  .j ava 2  s. com*/
    }

    if (path instanceof ExpressionPath) {
        validateExpressionPath((ExpressionPath) path, xmlns);
    }
}