Package org.apache.cocoon.stax.component

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


     */
    @Test(expected = SetupException.class)
    public void pipelineWithWrongComponents() {
        Pipeline<PipelineComponent> pipeline = new NonCachingPipeline<PipelineComponent>();
        pipeline.addComponent(new org.apache.cocoon.sax.component.XMLGenerator("<test/>"));
        pipeline.addComponent(new XMLSerializer());

        pipeline.setup(new ByteArrayOutputStream());
        fail("Mixing wrong components which has to result in a SetupException");
    }
View Full Code Here


        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);
        pipe.addComponent(new XMLSerializer());

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        pipe.setup(out);
        pipe.execute();
View Full Code Here

        List<Attribute> atts = new ArrayList<Attribute>();
        atts.add(factory.createAttribute("attribute", "bad"));
        atts.add(factory.createAttribute("attribute", "good"));
        DeletionTransformer deleter = new DeletionTransformer("anyelement", atts);
        pipe.addComponent(deleter);
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();

        input.close();
        String created = out.toString();
View Full Code Here

        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();

        String created = new String(out.toByteArray());
        out.close();
View Full Code Here

    private void doTest(int count) throws Exception {
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new GeneratingStarter("root", "element", count));
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();

        String created = new String(out.toByteArray());
        out.close();
View Full Code Here

    @Test
    public void testHugeInSmallOut() throws Exception {
        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new GeneratingStarter("root", "element", this.TEST_SIZE));
        pipe.addComponent(new OmitElementTransformer("element", new ArrayList<Attribute>()));
        pipe.addComponent(new XMLSerializer());

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        pipe.setup(out);
        pipe.execute();
        out.close();
View Full Code Here

        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

        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();

        out.close();
    }
View Full Code Here

                "/org/apache/cocoon/stax/converter/complex-stax-test-document.xml").openStream();
        ByteArrayOutputStream outputStAX = new ByteArrayOutputStream();
        NonCachingPipeline<StAXPipelineComponent> pipeStAX = new NonCachingPipeline<StAXPipelineComponent>();
        pipeStAX.addComponent(new org.apache.cocoon.stax.component.XMLGenerator(input));
        pipeStAX.addComponent(new SAXForStAXPipelineWrapper(new CleaningTransformer()));
        pipeStAX.addComponent(new XMLSerializer());
        pipeStAX.setup(outputStAX);
        pipeStAX.execute();
        input.close();

        String outputStAXString = outputStAX.toString();
View Full Code Here

TOP

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

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.