Package org.apache.cocoon.components.sax

Examples of org.apache.cocoon.components.sax.XMLByteStreamInterpreter


        constraints = new ArrayList();
        constraintAliases = new HashMap();
        redirect = null;
        redirectLevel = 0;
//        define = false;
        xmli = new XMLByteStreamInterpreter();
        xmli.setContentHandler(new EmbeddedXMLPipe(this));
    }
View Full Code Here


    }
   
    public void generateDisplayData(String name, ContentHandler contentHandler) throws SAXException {
        Object data = this.displayData.get(name);
        if (data != null) {
            XMLByteStreamInterpreter interpreter = new XMLByteStreamInterpreter();
            interpreter.setContentHandler(contentHandler);
            interpreter.deserialize(data);
           
        } else if (!this.displayData.containsKey(name)) {
            throw new IllegalArgumentException("Unknown display data name '" + name + "'");
        }
    }
View Full Code Here

            throw new IllegalArgumentException("Unknown display data name '" + name + "'");
        }
    }
   
    public void generateDisplayData(ContentHandler contentHandler) throws SAXException {
        XMLByteStreamInterpreter interpreter = new XMLByteStreamInterpreter();
       
        // Output all non-null display data
        Iterator iter = this.displayData.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry entry = (Map.Entry)iter.next();
            if (entry.getValue() != null) {
                String name = (String)entry.getKey();
               
                // Enclose the data into a "wi:{name}" element
                contentHandler.startElement(Constants.WI_NS, name, Constants.WI_PREFIX_COLON + name, Constants.EMPTY_ATTRS);

                interpreter.setContentHandler(contentHandler);
                interpreter.deserialize(entry.getValue());
                interpreter.recycle();
               
                contentHandler.endElement(Constants.WI_NS, name, Constants.WI_PREFIX_COLON + name);
            }
        }
       
View Full Code Here

                && (localName.equals("widget") || localName.equals("repeater-widget"))) {

            if (repeaterWidget) {
                Repeater repeater = (Repeater)widget;
                WidgetReplacingPipe rowPipe = new WidgetReplacingPipe();
                XMLByteStreamInterpreter interpreter = new XMLByteStreamInterpreter();
                int rowCount = repeater.getSize();
                Object saxFragment = xmlCompiler.getSAXFragment();
                for (int i = 0; i < rowCount; i++) {
                    Repeater.RepeaterRow row = repeater.getRow(i);
                    rowPipe.init(row);
                    rowPipe.setContentHandler(contentHandler);
                    rowPipe.setLexicalHandler(lexicalHandler);
                    interpreter.setConsumer(rowPipe);
                    interpreter.deserialize(saxFragment);
                    interpreter.recycle();
                    rowPipe.recycle();
                }
            } else {
                stylingHandler.recycle();
                stylingHandler.setSaxFragment(xmlCompiler.getSAXFragment());
View Full Code Here

                                              this.configurationParameters,
                                              this.resourceParameters,
                                              this.resolver);

                XMLByteStreamCompiler serializer;
                XMLByteStreamInterpreter deserializer;
                try {
                    if ( ignoreErrors ) {
                        serializer = new XMLByteStreamCompiler();
                        deserializer = new XMLByteStreamInterpreter();
                        SourceUtil.toSAX(source, serializer, this.configurationParameters, true);
                        deserializer.setConsumer( this.xmlConsumer );
                        deserializer.deserialize( serializer.getSAXFragment() );
                    } else {
                        SourceUtil.toSAX(source, this.xmlConsumer, this.configurationParameters, true);
                    }
                } catch (ProcessingException pe) {
                    if (!ignoreErrors) {
View Full Code Here

     * @see org.xml.sax.ContentHandler#endDocument()
     */
    public void endDocument() throws SAXException {
        if ( this.compiling ) {
            Object compiledXML = this.endCompiledXMLRecording();
            XMLByteStreamInterpreter deserializer = new XMLByteStreamInterpreter();
            deserializer.setConsumer(this.filter);
            deserializer.deserialize(compiledXML);
        }
        super.endDocument();
    }
View Full Code Here

            this.connect(environment, prev, next);

        } else {
            // Here the first part of the pipeline has been retrived from cache
            // we now check if any part of the rest of the pipeline can be cached
            this.xmlDeserializer = new XMLByteStreamInterpreter();
            // connect the pipeline:
            XMLProducer prev = xmlDeserializer;
            XMLConsumer next;
            int cacheableTransformerCount = 0;
            Iterator itt = this.transformers.iterator();
View Full Code Here

                // use the response from the cache
                result = (byte[])object;
            }
           
            // stream the content
            XMLByteStreamInterpreter deserializer = new XMLByteStreamInterpreter();
            deserializer.setConsumer(handler);
            deserializer.deserialize(result);
            return;
           
        } else {
            // we are not processing parallel
           
            // first: test for a cached response
            IncludeCacheStorageProxy storage = session.getCacheStorageProxy();
            CachedResponse response = (CachedResponse)storage.get(uri);
            if ( null != response) {
                SourceValidity[] validities = response.getValidityObjects();
                // if purging is turned off and either the cached response is valid or
                // we are loading preemptive, then use the cached response
                if ( !session.isPurging()
                      && (session.isPreemptive() || validities[0].isValid() == SourceValidity.VALID)) {

                    // stream the content                   
                    if (this.getLogger().isDebugEnabled()) {
                        this.getLogger().debug("Streaming from cached response.");
                    }
                    XMLByteStreamInterpreter deserializer =  new XMLByteStreamInterpreter();
                    deserializer.setConsumer(handler);
                    deserializer.deserialize(response.getResponse());
                   
                    // load preemptive if the response is not valid
                    if ( session.getExpires() > 0
                         && session.isPreemptive()
                         && validities[0].isValid() != SourceValidity.VALID) {
View Full Code Here

                } else {
                    super.connectPipeline( environment );
                }
            } else {
                // we use the cache, so we need an xml deserializer
                this.xmlDeserializer = new XMLByteStreamInterpreter();
            }
        } else {
            // external: we only need to connect if we don't use a cached response
            if ( this.cachedResponse == null) {
                super.connectPipeline( environment );
View Full Code Here

                next = new XMLTeePipe(next, localXMLSerializer);
                localXMLSerializer = null;
            }
            connect(environment, prev, next);
        } else {
            this.xmlDeserializer = new XMLByteStreamInterpreter();

            // connect the pipeline:
            XMLProducer prev = xmlDeserializer;
            XMLConsumer next;
            int cacheableTransformerCount = 0;
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.sax.XMLByteStreamInterpreter

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.