Examples of SaxBuffer


Examples of org.apache.cocoon.xml.SaxBuffer

                    if (element.fallback != null) {
                        throw new SAXException("Duplicate element " + FALLBACK_ELEMENT + ".");
                    }

                    /* Buffer fallback content */
                    push(element.fallback = new SaxBuffer());

                    /* Done with this element */
                    return;
                }

View Full Code Here

Examples of org.apache.cocoon.xml.SaxBuffer

                    /* Check for parallel processing */
                    if (this.parallel) {
                        if (!this.buffering) {
                            this.buffering = true;
                            buffer = new SaxBuffer();
                            push(buffer);
                        }

                        /* Process include element in separate thread */
                        buffer.xmlizable(new IncludeBuffer(element));
View Full Code Here

Examples of org.apache.cocoon.xml.SaxBuffer

     * XMLizable can be obtained by the matching {@link #endSAXRecording} call.
     * @since 2.1.5
     */
    public void startSAXRecording()
    throws SAXException {
        addRecorder(new SaxBuffer());
        sendStartPrefixMapping();
    }
View Full Code Here

Examples of org.apache.cocoon.xml.SaxBuffer

        /** Load URI into the provided handlers, process fallback */
        public void process(ContentHandler contentHandler, LexicalHandler lexicalHandler)
        throws SAXException {
            try {
                if (this.fallback != null) {
                    SaxBuffer buffer = new SaxBuffer();
                    process(buffer);
                    buffer.toSAX(contentHandler);
                } else {
                    process0(contentHandler, lexicalHandler);
                }
            } catch (SAXException e) {
                // source must not be cached if an error occurs
View Full Code Here

Examples of org.apache.cocoon.xml.SaxBuffer

        if (this.errorPipeline != null) {
            return this.errorPipeline.process(environment, consumer);
        }

        // Have to buffer events if error handler is specified.
        SaxBuffer buffer = null;
        this.lastConsumer = this.errorHandler == null? consumer: (buffer = new SaxBuffer());
        try {
            connectPipeline(environment);
            return processXMLPipeline(environment);
        } catch (ProcessingException e) {
            buffer = null;
            return processErrorHandler(environment, e, consumer);
        } finally {
            if (buffer != null) {
                try {
                    buffer.toSAX(consumer);
                } catch (SAXException e) {
                    throw new ProcessingException("Failed to execute pipeline.", e);
                }
            }
        }
View Full Code Here

Examples of org.apache.cocoon.xml.SaxBuffer

            param_name = attr.getValue(I18N_PARAM_NAME_ATTRIBUTE);
            if (param_name == null) {
                param_name = String.valueOf(param_count++);
            }

            param_recorder = new SaxBuffer();
            setFormattingParams(attr);
            current_state = STATE_INSIDE_PARAM;
        } else if (I18N_CHOOSE_ELEMENT.equals(name)) {
            if (current_state != STATE_OUTSIDE) {
                throw new SAXException(
View Full Code Here

Examples of org.apache.cocoon.xml.SaxBuffer

    private void i18nCharacters(String textValue) throws SAXException {
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("i18n message text = '" + textValue + "'");
        }

        SaxBuffer buffer;
        switch (current_state) {
            case STATE_INSIDE_TEXT:
                buffer = text_recorder;
                break;

            case STATE_INSIDE_PARAM:
                buffer = param_recorder;
                break;

            case STATE_INSIDE_WHEN:
            case STATE_INSIDE_OTHERWISE:
                // Previously handeld to avoid the String() conversion.
                return;

            case STATE_INSIDE_TRANSLATE:
                if (tr_text_recorder == null) {
                    tr_text_recorder = new ParamSaxBuffer();
                }
                buffer = tr_text_recorder;
                break;

            case STATE_INSIDE_CHOOSE:
                // No characters allowed. Send an exception ?
                if (getLogger().isDebugEnabled()) {
                    textValue = textValue.trim();
                    if (textValue.length() > 0) {
                        getLogger().debug("No characters allowed inside <i18n:choose> tag. Received: " + textValue);
                    }
                }
                return;

            case STATE_INSIDE_DATE:
            case STATE_INSIDE_DATE_TIME:
            case STATE_INSIDE_TIME:
            case STATE_INSIDE_NUMBER:
                // Trim text values to avoid parsing errors.
                textValue = textValue.trim();
                if (textValue.length() > 0) {
                    if (formattingParams.get(I18N_VALUE_ATTRIBUTE) == null) {
                        formattingParams.put(I18N_VALUE_ATTRIBUTE, textValue);
                    } else {
                        // ignore the text inside of date element
                    }
                }
                return;

            default:
                throw new IllegalStateException(getClass().getName() +
                                                " developer's fault: characters not handled. " +
                                                "Current state: " + current_state);
        }

        char[] ch = textValue.toCharArray();
        buffer.characters(ch, 0, ch.length);
    }
View Full Code Here

Examples of org.apache.cocoon.xml.SaxBuffer

        if (colonPos != -1) {
            catalogueID = key.substring(0, colonPos);
            key = key.substring(colonPos + 1, key.length());
        }

        final SaxBuffer text = getMessage(catalogueID, key);
        if (text == null) {
            getLogger().warn("Translation not found for attribute " +
                             name + " in element <" + element + ">");
            return untranslated;
        }
        return text.toString();
    }
View Full Code Here

Examples of org.apache.cocoon.xml.SaxBuffer

     * A default value is returned if message is not found.
     *
     * @return SaxBuffer containing message, or defaultValue if not found.
     */
    private ParamSaxBuffer getMessage(String key, ParamSaxBuffer defaultValue) {
        SaxBuffer value = getMessage(currentCatalogueId, key);
        if (value == null) {
          getLogger().debug("Untranslated key: '" + key + "'");
            return defaultValue;
        }

View Full Code Here

Examples of org.apache.cocoon.xml.sax.SAXBuffer

    /**
     * Start recording of SAX events. All incoming events are recorded and not forwarded. The
     * resulting SAXBuffer can be obtained by the matching {@link #endSAXRecording} call.
     */
    public void startSAXRecording() throws SAXException {
        this.setRecorder(new SAXBuffer());
        this.sendStartPrefixMapping();
    }
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.