Package org.apache.cocoon.sax.component

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


        }

        if (outputProperties == null) {
            outputProperties = new Properties();
        }
        pipeline.addComponent(new XMLSerializer(outputProperties));

        pipeline.setup(outputStream, null);
        pipeline.execute();
    }
View Full Code Here


        NonCachingPipeline<SAXPipelineComponent> pipeSAX = new NonCachingPipeline<SAXPipelineComponent>();
        ByteArrayOutputStream outputSAX = new ByteArrayOutputStream();
        pipeSAX.addComponent(new org.apache.cocoon.sax.component.XMLGenerator(CleaningTransformerTest.class
                .getResource("/org/apache/cocoon/stax/converter/complex-stax-test-document.xml").openStream()));
        pipeSAX.addComponent(new CleaningTransformer());
        pipeSAX.addComponent(new XMLSerializer());
        pipeSAX.setup(outputSAX);
        pipeSAX.execute();

        String outputSAXString = outputSAX.toString();
        outputSAX.close();

        // 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();
        input.close();

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

    /**
     * {@inheritDoc}
     */
    public LinkedPipelineConfigurationBuilder<SAXPipelineComponent> addSerializer() {
        this.pipeline.addComponent(new XMLSerializer());

        return new LinkedPipelineConfigurationBuilder<SAXPipelineComponent>() {

            @SuppressWarnings("unchecked")
            public LinkedPipelineSetupBuilder<SAXPipelineComponent> withEmptyConfiguration() {
View Full Code Here

    public void testPipelineWithSolrConsumer() throws Exception {
        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();

        pipeline.addComponent(new XMLGenerator(this.getClass().getResource("sample.xml")));
        pipeline.addComponent(new SolrConsumer(this.solr));
        pipeline.addComponent(new XMLSerializer());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pipeline.setup(baos);
        pipeline.execute();
View Full Code Here

    @Test
    public void testPipelineWithNekoGenerator() throws Exception {
        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
        pipeline.addComponent(new NekoGenerator(this.getClass().getResource("sample.html")));
        pipeline.addComponent(new XMLSerializer());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pipeline.setup(baos);
        pipeline.execute();
View Full Code Here

    public void testPipelineWithBeanGenerator() throws Exception {
        Animal animal = new Animal(5, "Dook", "albino", "Mustela putoris furo", "Lector");

        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
        pipeline.addComponent(new BetwixtBeanGenerator(animal));
        pipeline.addComponent(new XMLSerializer());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pipeline.setup(baos);
        pipeline.execute();
View Full Code Here

        IntrospectionConfiguration configuration = xmlIntrospector.getConfiguration();
        configuration.setAttributesForPrimitives(true);

        Pipeline<PipelineComponent> pipeline = new NonCachingPipeline<PipelineComponent>();
        pipeline.addComponent(new BetwixtBeanGenerator(animal, bindingConfiguration, xmlIntrospector));
        pipeline.addComponent(new XMLSerializer());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pipeline.setup(baos);
        pipeline.execute();
View Full Code Here

    }

    private void internalAssert(GenericType<?> genericType, String expected) throws Exception {
        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
        pipeline.addComponent(new JAXBGenerator(genericType));
        pipeline.addComponent(new XMLSerializer());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pipeline.setup(baos);
        pipeline.execute();
View Full Code Here

    private Pipeline<SAXPipelineComponent> createValidatingPipeline(String xmlInput) {
        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
        pipeline.addComponent(new XMLGenerator(xmlInput));
        pipeline.addComponent(new SchemaProcessorTransformer(this.getClass().getResource("/test.xsd")));
        pipeline.addComponent(new XMLSerializer());

        return pipeline;
    }
View Full Code Here

        attributes.put("package-name", "org.apache.cocoon.sax");

        newCachingPipeline()
            .setStarter(new XMLGenerator("<x></x>"))
            .addComponent(new XSLTTransformer(this.getClass().getResource("/test.xslt"), attributes))
            .setFinisher(new XMLSerializer())
            .withEmptyConfiguration()
            .setup(baos)
            .execute();

        Diff diff = new Diff("<?xml version=\"1.0\" encoding=\"UTF-8\"?><p></p>", new String(baos.toByteArray()));
View Full Code Here

TOP

Related Classes of org.apache.cocoon.sax.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.