Package com.volantis.xml.namespace

Examples of com.volantis.xml.namespace.ImmutableExpandedName


    public void testConcatDifferentTypes() throws Exception {

        Value one = factory.createIntValue(1);

        context.getCurrentScope().declareVariable(
                        new ImmutableExpandedName("", "myVar"),
                        one);

        context.getCurrentScope().declareVariable(
                        new ImmutableExpandedName("", "emptySeq"),
                        Sequence.EMPTY);

        context.getCurrentScope().declareVariable(
                        new ImmutableExpandedName("", "singleSeq"),
                        factory.createSequence(new Item[]
                        {factory.createStringValue("one")}));

        Expression exp = compileExpression(
                "concat(true(), 25.9, $emptySeq, $myVar, $singleSeq)");
View Full Code Here


     */
    public void testConcatMultiValueSequence() throws Exception {

        // declare a variable whose value is a sequence of 2 items
        context.getCurrentScope().declareVariable(
                                new ImmutableExpandedName("", "seq"),
                                factory.createSequence(new Item[]
                                    {factory.createStringValue("one"),
                                     factory.createStringValue("two")}));


View Full Code Here

    public void testAndOperatorWithVariables() throws Exception {

        Value one = factory.createIntValue(1);

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                one);


        Expression exp = compileExpression("$myVar <= 1 and 4 > $myVar");
View Full Code Here

    public void testOrOperatorWithVariables() throws Exception {

        Value one = factory.createIntValue(1);

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                one);


        Expression exp = compileExpression("$myVar <= 1 or 0 > $myVar");
View Full Code Here

                   ((BooleanValue) result).asJavaBoolean());
    }

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

        Expression exp = compileExpression("$myVar != \"" +
                                           result.stringValue().
                                           asJavaString() + "\"");
View Full Code Here

        assertFalse("Inequality expression result should be false",
                    ((BooleanValue) result).asJavaBoolean());
    }
   
    public void testFunctionArgSequence() throws Exception {
        ImmutableExpandedName functionName =
                new ImmutableExpandedName("http://myNamespace", "test");
        NamespacePrefixTracker manager = context.getNamespacePrefixTracker();

        manager.startPrefixMapping("function",
                                   functionName.getNamespaceURI());

        context.registerFunction(
                functionName,
                new Function() {
                    public Value invoke(ExpressionContext context,
View Full Code Here

                     "(a, b), (c, d), e",  eval.stringValue().asJavaString());
    }
   

    public void testExpressionWithFunction() throws Exception {
        ImmutableExpandedName functionName =
                new ImmutableExpandedName("http://myNamespace", "test");
        NamespacePrefixTracker manager = context.getNamespacePrefixTracker();

        manager.startPrefixMapping("function",
                                   functionName.getNamespaceURI());

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "myVar"),
                result);

        context.registerFunction(
                functionName,
                new Function() {
View Full Code Here

     * the function is evaluated.
     *
     * @throws Exception if an unexpected exception occurs
     */
    public void testFunctionThrowingExpressionException() throws Exception {
        ImmutableExpandedName functionName =
                new ImmutableExpandedName("http://myNamespace", "test");
        NamespacePrefixTracker manager = context.getNamespacePrefixTracker();

        manager.startPrefixMapping("function",
                                   functionName.getNamespaceURI());

        context.registerFunction(
                functionName,
                new Function() {
                    public Value invoke(ExpressionContext context,
View Full Code Here

                    "Cannot expand the variable " + name +
                    " as no NamespacePrefixTracker has been defined");
        } else if (namespacePrefixTracker == null) {
            // The "default namespace" is used to represent the "no namespace"
            // for variables: see comment below
            expandedName = new ImmutableExpandedName("",
                                                     name);
        } else {
            // The given name could be a prefixed name, so go through these
            // hoops to ensure that we register the variable against the
            // correct namespace (the namespace for no prefix is "no namespace"
View Full Code Here

        contextMock.expects.getCurrentLocator().returns(locator).any();

        attributes = new AttributesImpl();

        elementName = new ImmutableExpandedName("namespace", "element");
    }
View Full Code Here

TOP

Related Classes of com.volantis.xml.namespace.ImmutableExpandedName

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.