Package org.apache.cocoon.xml

Examples of org.apache.cocoon.xml.IncludeXMLConsumer


            base = null;
        }
        Source source = null;
        try {
            source = resolver.resolveURI(uri, base, null);
            SourceUtil.toSAX(source, new IncludeXMLConsumer(contentHandler));
        } catch (Exception e) {
            throw new CascadingRuntimeException("Error including source " + base + " " + uri, e);
        } finally {
            if (source != null) {
                resolver.release(source);
View Full Code Here


    public static void includeInputSource(InputSource source, ComponentManager manager, ContentHandler contentHandler)
            throws RuntimeException {
        SAXParser parser = null;
        try {
            parser = (SAXParser)manager.lookup(SAXParser.ROLE);
            IncludeXMLConsumer consumer = new IncludeXMLConsumer(contentHandler);
            parser.parse(source, consumer, consumer);
        } catch (Exception e) {
            throw new CascadingRuntimeException("Could not include page", e);
        } finally {
            if (parser != null) {
View Full Code Here

        String mimeTypeHint = null;
        if (typeParameters != null) {
            mimeTypeHint = typeParameters.getParameter("mime-type", mimeTypeHint);
        }
        if (filterDocumentEvent) {
            IncludeXMLConsumer filter = new IncludeXMLConsumer(handler);
            toSAX(source, mimeTypeHint, filter);
        } else {
            toSAX(source, mimeTypeHint, handler);
        }
    }
View Full Code Here

    public void generate() throws IOException, SAXException, ProcessingException {
        xmlConsumer.startDocument();

        if (this.elementName != null) {
            xmlConsumer.startElement("", this.elementName, this.elementName, new AttributesImpl());
            XMLUtils.valueOf(new IncludeXMLConsumer(xmlConsumer), this.attrObject);
            xmlConsumer.endElement("", this.elementName, this.elementName);
        } else {
            XMLUtils.valueOf(new IncludeXMLConsumer(xmlConsumer), this.attrObject);
        }
       
        xmlConsumer.endDocument();
    }
View Full Code Here

                            XPointer xpointer;
                            xpointer = XPointerFrameworkParser.parse(NetUtils.decodePath(suffix));
                            XPointerContext context = new XPointerContext(suffix, url, subPipe, getLogger(), manager);
                            xpointer.process(context);
                        } else {
                            SourceUtil.toSAX(url, new IncludeXMLConsumer(subPipe));
                        }
                        // restore locator on the consumer
                        if (locator != null)
                            xmlConsumer.setDocumentLocator(locator);
                    } catch (ResourceNotFoundException e) {
View Full Code Here

    private void stream() throws SAXException  {
        if (attributeName != null)  {
            Object node = session.getAttribute(attributeName);
            if (node != null)  {
                getLogger().debug("Start streaming");
                XMLUtils.valueOf(new IncludeXMLConsumer(super.xmlConsumer), node);
            } else {
                getLogger().error("No attribute " + attributeName + " in session");
            }
        } else {
            getLogger().error("No "+ ATTRIBUTE_NAME + " parameter specified");
View Full Code Here

    throws Exception {
        SAXParser parser = null;
        try {
            parser = (SAXParser) manager.lookup(SAXParser.ROLE);
            InputSource is = new InputSource(new StringReader(data));
            parser.parse(is, new IncludeXMLConsumer(super.xmlConsumer));
        } finally {
            manager.release(parser);
        }
    }
View Full Code Here

            DOMBuilder builder = new DOMBuilder();
            builder.startDocument();
            builder.startElement("", "root", "root", new AttributesImpl());

            IncludeXMLConsumer filter = new IncludeXMLConsumer(builder, builder);
            parser.parse(input, filter);

            builder.endElement("", "root", "root");
            builder.endDocument();
View Full Code Here

                String mimeType = null;
                if ( null != this.configurationParameters ) {
                    mimeType = this.configurationParameters.getParameter("mime-type", mimeType);                   
                }
                if ( this.compiling ) {
                    SourceUtil.toSAX(source, mimeType, new IncludeXMLConsumer(this.contentHandler, this.lexicalHandler));
                } else {
                    SourceUtil.toSAX(source, mimeType, this.filter);
                }
            }
View Full Code Here

            XMLDeserializer deserializer = null;

            try {
                deserializer = (XMLDeserializer) this.manager.lookup(XMLDeserializer.ROLE);
                if (embed)
                    deserializer.setConsumer(new IncludeXMLConsumer(this.xmlConsumer));
                else
                    deserializer.setConsumer(this.xmlConsumer);
                deserializer.deserialize(fragment);
            } catch (ServiceException ce) {
                getLogger().debug("Could not retrieve XMLDeserializer component",
View Full Code Here

TOP

Related Classes of org.apache.cocoon.xml.IncludeXMLConsumer

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.