Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Expression


            factory.createSequence(left));
        context.getCurrentScope().declareVariable(
            new ImmutableExpandedName("", "right"),
            factory.createSequence(right));

        Expression exp = compileExpression("$left = (($right))");
        Value result = exp.evaluate(context);     
        assertTrue("Nested variable comparison failed",
            ((BooleanValue) result).asJavaBoolean());
    }
View Full Code Here


        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("http://myNamespace",
                                          "var"),
                result);

        Expression exp = compileExpression("$p:var");

        assertTrue("Variable expression evaluation failed",
                   exp.evaluate(context) == result);
    }
View Full Code Here

    public void testUnqualifiedVariableEvaluate() throws Exception {
        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                result);

        Expression exp = compileExpression("$myVar");

        assertTrue("Variable expression evaluation failed",
                   exp.evaluate(context) == result);
    }
View Full Code Here

     * Ensures that an unqualified variable reference that has not be declared
     * cannot be evaluated
     * @throws Exception if an error occurs
     */
    public void testUnDeclaredVariableEvaluate() throws Exception {
        Expression exp = compileExpression("$myVar");
        try {
            exp.evaluate(context);

            fail("Expected an expression exception");
        } catch (ExpressionException e) {
            // Expected condition
        }
View Full Code Here

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                factory.createSequence(items));

        Expression exp = compileExpression("$myVar[1]");

        assertTrue("Variable expression evaluation failed",
                   exp.evaluate(context) == items[0]);
    }
View Full Code Here

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                factory.createSequence(items));

        Expression exp = compileExpression("$myVar[2]");

        assertTrue("Variable expression evaluation failed",
                   exp.evaluate(context) == items[1]);
    }
View Full Code Here

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                factory.createSequence(items));

        Expression exp = compileExpression("$myVar[3]");

        assertTrue("Variable expression evaluation failed",
                   exp.evaluate(context) == items[2]);
    }
View Full Code Here

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                factory.createSequence(items));

        Expression exp = compileExpression("$myVar[4]");

        Value result = exp.evaluate(context);

        // result should be an empty sequence
        assertTrue("Result is not a Sequence instance",
                   result instanceof Sequence);
View Full Code Here

                ExpressionFactory.getDefaultInstance();

        ExpressionContext expressionContext =
                pipelineContext.getExpressionContext();

        Expression expression =
                expressionFactory.createExpressionParser().parse(
                    expressionString);
        Value result = expression.evaluate(expressionContext);
        return PipelineExpressionHelper.fnBoolean(result.getSequence())
                .asJavaBoolean();
    }
View Full Code Here

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                factory.createSequence(items));


        Expression exp = compileExpression("$myVar[0]");

        Value result = exp.evaluate(context);

        // result should be an empty sequence
        assertTrue("Result is not a Sequence instance",
                   result instanceof Sequence);
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.