Package com.volantis.xml.pipeline.sax

Examples of com.volantis.xml.pipeline.sax.XMLPipelineContext


            throws SAXException {

        TryProcess process = (TryProcess) object;
        TryModel model = process;

        XMLPipelineContext context = dynamicProcess.getPipelineContext();
        if (!context.inErrorRecoveryMode()) {
            model.endTry();

            context.popObject(model);
        }

        dynamicProcess.removeProcess(process);

        if (!context.inErrorRecoveryMode()) {
            SAXParseException exception = model.getException(context);
            if (exception != null) {
                getTargetProcess(dynamicProcess).error(exception);
            }
        }
View Full Code Here


                }
                // strip off the %{ } so that we are left with the xpath
                String expressionStr =
                        PipelineExpressionHelper.removePipelineQuoting(
                                value, exprPrefixes, exprSuffixes);
                XMLPipelineContext pipelineContext = getPipelineContext();
                try {
                    // parse the xpath

                    Expression expression = parser.parse(expressionStr);
                    // obtain the ExpressionContext from the PipelineContext
                    // the ExpressionContext is needed in order to evaluate the
                    // 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 {
                        // update the current attribute with the string
                        // representation of the evaluated expression.
                        output.setValue(i, result.stringValue().asJavaString());
                    }
                }
                catch (Exception e) {
                    // something went wrong when evaluating the xpath.
                    // Send an error down the pipeline
                    Locator locator = pipelineContext.getCurrentLocator();
                    XMLPipelineException se = new XMLPipelineException(
                            "Could not evaluate the expression " +
                            expressionStr,
                            locator,
                            e);
View Full Code Here

    public TValue createSimpleValue(String value)
            throws SAXException {

        transition(TemplateSchema.VALUE_START);

        XMLPipelineContext context = getPipelineContext();
        XMLPipelineFactory factory = context.getPipelineFactory();
        PipelineRecorder recorder = factory.createPipelineRecorder();
        recorder.startRecording(getPipeline());
        char[] chars = value.toCharArray();
        recorder.getRecordingHandler().characters(chars, 0, chars.length);
        PipelineRecording recording = recorder.stopRecording();
View Full Code Here

        startElement(element);

        this.mode = mode;

        XMLPipelineContext context = getPipelineContext();
        XMLPipelineFactory factory = context.getPipelineFactory();
        recorder = factory.createPipelineRecorder();
        recorder.startRecording(getPipeline());
        contentHandler = recorder.getRecordingHandler();
    }
View Full Code Here

        WSDLOperation operation = new WSDLOperation(wsdlURI,
                                                    portType,
                                                    operationName);

        XMLPipelineContext context = getPipelineContext();

        context.setProperty(Operation.class, operation, false);
    }
View Full Code Here

            EnvironmentContext environmentContext =
                    ContextInternals.getEnvironmentContext( requestContext );

            // The getXMLReader() call above will set up the pipelineContext in
            // the environmentContext.  See MarlinSAXHelper.setPipelineContext()
            XMLPipelineContext pipelineContext =
                    environmentContext.getPipelineContext();
            // set the Base URI in the pipeline's context
            try {
                URL baseURI = new URL( baseUrl );
                if( logger.isDebugEnabled() ) {
                    logger.debug( "Setting Base URI "
                                        + baseURI.toExternalForm() );
                }
                pipelineContext.pushBaseURI( baseURI.toExternalForm() );
            } catch( MalformedURLException e ) {
                throw new MessageException( e );
            }
            reader.parse( new InputSource( new StringReader( messageXML ) ) );
View Full Code Here

        }
        inDocument = true;

        try {
            if (locator != null) {
                XMLPipelineContext pipelineContext = getPipelineContext();
                // store the locator away in the XMLPipelineContext. The Locator
                // is useful when reporting errors
                pipelineContext.pushLocator(locator);
                pipelineContext.pushBaseURI(locator.getSystemId());
            } else if (!allowNullLocator) {
                warning(new XMLPipelineException("The document does not " +
                                                 "have an associated Locator.", null));
            }
        } catch (MalformedURLException e) {
View Full Code Here

                             String localName,
                             String qName,
                             Attributes atts) throws SAXException {
        Attributes attributes = atts;
        // obtain the pipeline context
        XMLPipelineContext pipelineContext = getPipelineContext();
        try {
            // retrieve the base uri if any
            String baseURI = atts.getValue(NamespaceSupport.XMLNS,
                                           BASE_ATTRIBUTE);
            // push the base URI onto the context - OK to push null
            pipelineContext.pushBaseURI(baseURI);

            if (baseURI != null) {
                AttributesImpl cloneAttrs = new AttributesImpl(atts);
                int index = cloneAttrs.
                        getIndex(NamespaceSupport.XMLNS, BASE_ATTRIBUTE);
                cloneAttrs.removeAttribute(index);
                attributes = cloneAttrs;
            }
        } catch (MalformedURLException e) {
            fatalError(new XMLPipelineException(
                    "base uri attribute is malformed",
                    pipelineContext.getCurrentLocator(),
                    e));
        }
        // forward this event to the next process
        super.startElement(namespaceURI, localName, qName, attributes);
    }
View Full Code Here

        inDocument = false;

        // pop the locator and base URI that was pushed when the
        // setDocumentLocator event was received
        if (locator != null) {
            XMLPipelineContext pipelineContext = getPipelineContext();
            pipelineContext.popLocator();
            pipelineContext.popBaseURI();
            locator = null;
        }
    }
View Full Code Here

     * @return The template model.
     * @throws SAXException If the model could not be retrieved.
     */
    protected TemplateModel getModel(DynamicProcess dynamicProcess)
            throws SAXException {
        XMLPipelineContext context = dynamicProcess.getPipelineContext();
        TemplateModel model = (TemplateModel) context.findObject(
                TemplateModel.class);

        if (model == null) {
            throw forwardFatalError(dynamicProcess,
                    "Missing template:apply operation");
View Full Code Here

TOP

Related Classes of com.volantis.xml.pipeline.sax.XMLPipelineContext

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.