Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Expression.evaluate()


                });

        // Literal numbers are promoted to double values, not ints
        Expression exp = compileExpression("function:test('a', 2, $myVar)");

        Value eval = exp.evaluate(context);

        assertTrue("Expression should result in a string value",
                   eval instanceof StringValue);

        assertEquals("Expression result not as",
View Full Code Here


        // Compile and execute the function
        Expression exp = compileExpression("function:test()");

        try {
            Value eval = exp.evaluate(context);
            fail("Function should have thrown ExpressionException, but " +
                    "no exception thrown.");
        } catch (ExpressionException ee) {
            // Expected result - test successful
        }
View Full Code Here

        try {
            // try to evaluate the expression. The function has not been
            // registered with the context so we expect a ExpressionException
            // to be thrown.
            exp.evaluate(context);
            fail("Evaluating a non existent function should result in an " +
                 "ExpressionException");
        } catch (ExpressionException e) {
            // expected
        }
View Full Code Here

     * Test to ensure that an empty sequence is parsed and correctly evaluated
     * @throws Exception an error occurs
     */
    public void testEmptySequence() throws Exception {
        Expression exp = compileExpression("()");
        Value result = exp.evaluate(context);
        // result should be an empty sequence
        assertTrue("Result is not a Sequence instance",
                   result instanceof Sequence);

        Sequence sequence = (Sequence) result;
View Full Code Here

     * Test to ensure that an empty sequence inside an empty sequence is evaluated to empty sequence
     * @throws Exception an error occurs
     */
    public void testSequenceContainingEmptySequence() throws Exception {
        Expression exp = compileExpression("(())");
        Value result = exp.evaluate(context);
        // result should be an empty sequence
        assertTrue("Result is not a Sequence instance",
                   result instanceof Sequence);

        Sequence sequence = (Sequence) result;
View Full Code Here

     * Test to ensure that empty sequence item is removed after evaluation
     * @throws Exception an error occurs
     */
    public void testSequenceContainingEmptySequenceAndStrings() throws Exception {
        Expression exp = compileExpression("('a', (), 'b')");
        Value result = exp.evaluate(context);
        assertTrue("Result is not a Sequence instance",
                   result instanceof Sequence);

        Sequence sequence = (Sequence) result;

View Full Code Here

            ExpressionFactory factory = ExpressionFactory.getDefaultInstance();
            ExpressionParser parser = factory.createExpressionParser();
            try {
                // Parse, and evaluate the expression.
                Expression expression = parser.parse(expr);
                Value value = expression.evaluate(context);

                // Stream the value's contents into the process following the
                // dynamic process. Don't do it into the dynamic process as
                // that will cause any markup to get reevaluated.
                value.streamContents(getTargetProcess(dynamicProcess));
View Full Code Here

                    // expression parsed
                    ExpressionContext expressionContext =
                            getPipelineContext().getExpressionContext();

                    // evaluate the experssion
                    Value result = expression.evaluate(expressionContext);
                    if (result.getSequence().getLength() == 0) {
                        // if the sequence is empty then we must remove the
                        // attriubute.
                        output.removeAttribute(i);
                    } else {
View Full Code Here

        ExpressionFactory factory = expressionContext.getFactory();
        ExpressionParser parser = factory.createExpressionParser();
        Sequence sequence;
        try {
            Expression expression = parser.parse(expressionAsString);
            Value value = expression.evaluate(expressionContext);
            sequence = value.getSequence();
        } catch (ExpressionException e) {
            throw new ExtendedSAXException(e);
        }
        return sequence;
View Full Code Here

        ExpressionFactory expressionFactory = context.getFactory();
        ExpressionParser parser = expressionFactory.createExpressionParser();

        Expression expression = parser.parse(arguments[0].stringValue().asJavaString());
        return expression.evaluate(context);
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.