Examples of EndElementAction


Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

        model.startTemplate();

        // The presence or absence of the href attribute determines the gross
        // structure of the template:apply.
        String href = attributes.getValue("href");
        EndElementAction action;
        if (href == null) {

            // Template must be inline so a template:bindings element is
            // expected.
            action = new EndTemplateAction(model, process);
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

    // Javadoc inherited.
    public void endElement(
            DynamicProcess dynamicProcess, ExpandedName element, Object object)
            throws SAXException {

        EndElementAction action = (EndElementAction) object;
        action.doAction(dynamicProcess);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

        String defaultValue = attributes.getValue("default");

        String variable = attributes.getValue("expressionVariable");

        EndElementAction action;

        if (name == null) {
            throw forwardFatalError(dynamicProcess,
                    "A name must be provided for a parameter");
        } else if (use == Use.REQUIRED && defaultValue != null) {
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

    // Javadoc inherited.
    protected void endElementImpl(
            DynamicProcess dynamicProcess, ExpandedName element, Object object)
            throws SAXException {

        EndElementAction action = (EndElementAction) object;
        action.doAction(dynamicProcess);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

        InternalExpressionContext expressionContext =
                (InternalExpressionContext)
                context.getExpressionContext();

        // The iterator that is returned.
        EndElementAction action;

        // Evaluate the in expression to a sequence.
        String inExpression = attributes.getValue("in");
        final Sequence sequence = evaluateExpression(expressionContext, inExpression);
        int length = sequence.getLength();
        if (length == 0) {
            // The sequence is empty so there is nothing to do so just skip
            // the body and do not create an iterator.
            context.getFlowControlManager().exitCurrentElement();
            action = EndElementAction.DO_NOTHING;
        } else {

            // Resolve the variable name into an ExpandedName, if the variable
            // name does not have a prefix then it belongs in no namespace,
            // rather than the default namespace.
            String variableName = attributes.getValue("variable");
            QName variableQName = new ImmutableQName(variableName);
            final ExpandedName variableExpandedName =
                    context.getNamespacePrefixTracker()
                    .resolveQName(variableQName, null);

            // If the sequence only has a single value in then it is not
            // necessary to store the body away to be evaluated multiple times.
            if (length == 1) {

                // Create a new block scope to contain the variable.
                expressionContext.pushBlockScope();

                // Create a variable in the current stack frame.
                try {
                    expressionContext.getCurrentScope()
                            .declareVariable(variableExpandedName,
                                    sequence.getItem(1));
                } catch (SequenceIndexOutOfBoundsException e) {
                    throw new ExtendedSAXException(e);
                }

                // Remember to pop the block scope off after the content has
                // been processed.
                action = new PopBlockScopeAction();

            } else {

                // Make the dynamic process pass the element contents straight
                // through without evaluating them so that they can be recprded
                // and evaluated for each value of the variable. The dynamic
                // process will automatically come out of pass through mode
                // once it sees the matching end element event.
                dynamicProcess.passThroughElementContents();

                XMLPipelineFactory factory = context.getPipelineFactory();
                final PipelineRecorder recorder =
                        factory.createPipelineRecorder();
                recorder.startRecording(dynamicProcess.getPipeline());

                final XMLProcess process = recorder.getRecordingProcess();

                dynamicProcess.addProcess(process);

                // Create an action to wrap the iterator and remove the
                // recording process once the body has been evaluated.
                action = new EndElementAction() {
                    public void doAction(DynamicProcess dynamicProcess)
                            throws SAXException {

                        // Remove the process from the head.
                        dynamicProcess.removeProcess(process);
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

    public void endElement(
            DynamicProcess dynamicProcess, ExpandedName expandedName, Object o)
            throws SAXException {

        // Perform the action.
        EndElementAction action = (EndElementAction) o;
        action.doAction(dynamicProcess);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

        dynamicProcessMock.expects.getPipeline().returns(pipeline);
        dynamicProcessMock.fuzzy.addProcess(mockFactory.
                expectsInstanceOf(CacheBodyOperationProcess.class));

        //startElement
        EndElementAction action = (EndElementAction) rule.
                startElement(dynamicProcessMock, elementName, attributes);
        assertNotNull(action);
        assertNotEquals(action, EndElementAction.DO_NOTHING);

        //Prepare mocks for endElement method
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

        // Prepare mocks for startElement method
        contextMock.expects.findObject(CacheProperties.class).
                returns(null).any();

        //startElement   
        EndElementAction action = (EndElementAction) rule.
                startElement(dynamicProcessMock, elementName, attributes);

        assertNotNull(action);
        assertEquals(action, EndElementAction.DO_NOTHING);
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

        dynamicProcessMock.fuzzy.error(
                mockFactory.expectsInstanceOf(SAXParseException.class));

        DynamicElementRule rule = new CacheInfoRule();
        EndElementAction action = (EndElementAction) rule.startElement(
                dynamicProcessMock, elementName, attributes);
        assertNull(action);
        rule.endElement(dynamicProcessMock, elementName, action);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.EndElementAction

        dynamicProcessMock.fuzzy.error(mockFactory.
                expectsInstanceOf(SAXParseException.class));


        DynamicElementRule rule = new CacheInfoRule();
        EndElementAction action = (EndElementAction) rule.
                startElement(dynamicProcessMock, elementName, attributes);

        assertNull(action);

        rule.endElement(dynamicProcessMock, elementName, action);
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.