Examples of XMLGenerator


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

                .openStream();

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(input));
        XMLEventFactory factory = XMLEventFactory.newInstance();
        pipe.addComponent(new SubSetTransformer("element", factory.createAttribute(new QName("attribute"), "first")));
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();
View Full Code Here

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

                .openStream();

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(input));
        XMLEventFactory factory = XMLEventFactory.newInstance();
        pipe.addComponent(new SubSetTransformer("element", factory.createAttribute(new QName("attribute"), "second")));
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();
View Full Code Here

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

                .openStream();

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(input));
        XMLEventFactory factory = XMLEventFactory.newInstance();
        pipe.addComponent(new CleaningTransformer());
        pipe.addComponent(new SubSetTransformer("element", factory.createAttribute(new QName("attribute"), "second"),
                factory.createAttribute(new QName("attribute"), "first")));
        pipe.addComponent(new XMLSerializer());
View Full Code Here

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

                .openStream();

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(input));
        pipe.addComponent(new SubSetTransformer("element"));
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();
View Full Code Here

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

                IncludeTransformerTest.class.getResourceAsStream("/org/apache/cocoon/stax/includetest_input.xml"))
                .replaceAll("file_to_include\\.xml", include.toURI().toURL().toString());
        FileUtils.writeStringToFile(input, inputSource);

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(new FileInputStream(input)));
        pipe.addComponent(new IncludeTransformer());
        pipe.addComponent(new XMLSerializer());

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

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

        InputStream input = StAXPipelineTest.class.getResource("/org/apache/cocoon/stax/simple.xml").openStream();

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
        pipe.addComponent(new XMLGenerator(input));
        pipe.addComponent(new XMLSerializer());
        pipe.setup(out);
        pipe.execute();

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

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

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

                "/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

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

    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

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

        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
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.