Package org.apache.cocoon.stax.component

Examples of org.apache.cocoon.stax.component.XMLGenerator


    public void testDeletion() throws Exception {
        InputStream input = DeletionTransformerTest.class.getResource(
                "/org/apache/cocoon/stax/sample/stax-test-document.xml").openStream();

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(input));
        XMLEventFactory factory = XMLEventFactory.newInstance();
        List<Attribute> atts = new ArrayList<Attribute>();
        atts.add(factory.createAttribute("attribute", "bad"));
        DeletionTransformer deleter = new DeletionTransformer("anyelement", atts);
        pipe.addComponent(deleter);
View Full Code Here


                "/org/apache/cocoon/stax/sample/stax-test-document.xml").openStream();

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(input));
        XMLEventFactory factory = XMLEventFactory.newInstance();
        List<Attribute> atts = new ArrayList<Attribute>();
        atts.add(factory.createAttribute("attribute", "bad"));
        atts.add(factory.createAttribute("attribute", "good"));
        DeletionTransformer deleter = new DeletionTransformer("anyelement", atts);
View Full Code Here

    public void testEmitTransformer() throws Exception {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        InputStream in = new ByteArrayInputStream("<root/>".getBytes());

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(in));
        pipe.addComponent(new EmitElementTransformer("root", new ArrayList<Attribute>(), "element", 5));
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();
View Full Code Here

        tmpOutput.deleteOnExit();
        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tmpOutput));
        InputStream in = new ByteArrayInputStream("<root/>".getBytes());

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(in));
        pipe.addComponent(new EmitElementTransformer("root", new ArrayList<Attribute>(), "element", this.TEST_SIZE));
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();
    }
View Full Code Here

                        .getResourceAsStream("/org/apache/cocoon/stax/stress/stax-test-huge-include-input.xml"))
                .replaceAll("file_to_include\\.xml", include.toURI().toURL().toString());
        FileUtils.writeStringToFile(input, inputSource);
        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(output));
        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(new FileInputStream(input)));
        pipe.addComponent(new IncludeTransformer());
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();
View Full Code Here

        // StAX pipeline with SAXCleaningTransformer
        InputStream input = CleaningTransformerTest.class.getResource(
                "/org/apache/cocoon/stax/converter/complex-stax-test-document.xml").openStream();
        ByteArrayOutputStream outputStAX = new ByteArrayOutputStream();
        NonCachingPipeline<PipelineComponent> pipeStAX = new NonCachingPipeline<PipelineComponent>();
        pipeStAX.addComponent(new XMLGenerator(input));
        pipeStAX.addComponent(new StAXToSAXPipelineAdapter());
        pipeStAX.addComponent(new CleaningTransformer());
        pipeStAX.addComponent(new XMLSerializer());
        pipeStAX.setup(outputStAX);
        pipeStAX.execute();
View Full Code Here

TOP

Related Classes of org.apache.cocoon.stax.component.XMLGenerator

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.