Package org.milyn

Examples of org.milyn.Smooks.addVisitor()


  public void test_02() {

    Smooks smooks = new Smooks();

    smooks.addVisitor(new Value("customerNumber1", "customer/@number", Integer.class));
    smooks.addVisitor(new Value("customerNumber2", "customer/@number").setType(Integer.class));

    JavaResult result = new JavaResult();
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("../order-01.xml")), result);
View Full Code Here


  public void test_02() {

    Smooks smooks = new Smooks();

    smooks.addVisitor(new Value("customerNumber1", "customer/@number", Integer.class));
    smooks.addVisitor(new Value("customerNumber2", "customer/@number").setType(Integer.class));

    JavaResult result = new JavaResult();
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("../order-01.xml")), result);

    assertEquals(123123, result.getBean("customerNumber1"));
View Full Code Here

public class FreeMarkerProgramaticConfigTest extends TestCase {

    public void testFreeMarkerTrans_01() throws SAXException, IOException {
        Smooks smooks = new Smooks();

        smooks.addVisitor(new Bean(MyBean.class, "myBeanData", "c").bindTo("x", "c/@x"));
        smooks.addVisitor(new FreeMarkerTemplateProcessor(new TemplatingConfiguration("/org/milyn/templating/freemarker/test-template.ftl")),"c");

        test_ftl(smooks, "<a><b><c x='xvalueonc1' /><c x='xvalueonc2' /></b></a>", "<a><b><mybean>xvalueonc1</mybean><mybean>xvalueonc2</mybean></b></a>");
        // Test transformation via the <context-object /> by transforming the root element using StringTemplate.
        test_ftl(smooks, "<c x='xvalueonc1' />", "<mybean>xvalueonc1</mybean>");
View Full Code Here

    public void testFreeMarkerTrans_01() throws SAXException, IOException {
        Smooks smooks = new Smooks();

        smooks.addVisitor(new Bean(MyBean.class, "myBeanData", "c").bindTo("x", "c/@x"));
        smooks.addVisitor(new FreeMarkerTemplateProcessor(new TemplatingConfiguration("/org/milyn/templating/freemarker/test-template.ftl")),"c");

        test_ftl(smooks, "<a><b><c x='xvalueonc1' /><c x='xvalueonc2' /></b></a>", "<a><b><mybean>xvalueonc1</mybean><mybean>xvalueonc2</mybean></b></a>");
        // Test transformation via the <context-object /> by transforming the root element using StringTemplate.
        test_ftl(smooks, "<c x='xvalueonc1' />", "<mybean>xvalueonc1</mybean>");
    }
View Full Code Here

        test_nodeModel_1(StreamFilterType.SAX);
    }
    public void test_nodeModel_1(StreamFilterType filterType) throws IOException, SAXException, ParserConfigurationException {
        Smooks smooks = new Smooks();

        smooks.addVisitor(new DomModelCreator(), "$document");
        smooks.addVisitor(
                new FreeMarkerTemplateProcessor(new TemplatingConfiguration("<#foreach c in a.b.c>'${c}'</#foreach>")),
                "$document"
        );
View Full Code Here

    }
    public void test_nodeModel_1(StreamFilterType filterType) throws IOException, SAXException, ParserConfigurationException {
        Smooks smooks = new Smooks();

        smooks.addVisitor(new DomModelCreator(), "$document");
        smooks.addVisitor(
                new FreeMarkerTemplateProcessor(new TemplatingConfiguration("<#foreach c in a.b.c>'${c}'</#foreach>")),
                "$document"
        );

        smooks.setFilterSettings(new FilterSettings(filterType));
View Full Code Here

        test_nodeModel_2(StreamFilterType.SAX);
    }
    public void test_nodeModel_2(StreamFilterType filterType) throws IOException, SAXException, ParserConfigurationException {
        Smooks smooks = new Smooks();

        smooks.addVisitor(new DomModelCreator(), "c");
        smooks.addVisitor(
                new FreeMarkerTemplateProcessor(new TemplatingConfiguration("<x>'${c}'</x>")),
                "c"
        );
View Full Code Here

    }
    public void test_nodeModel_2(StreamFilterType filterType) throws IOException, SAXException, ParserConfigurationException {
        Smooks smooks = new Smooks();

        smooks.addVisitor(new DomModelCreator(), "c");
        smooks.addVisitor(
                new FreeMarkerTemplateProcessor(new TemplatingConfiguration("<x>'${c}'</x>")),
                "c"
        );

        smooks.setFilterSettings(new FilterSettings(filterType));
View Full Code Here

        StringReader input;
        ExecutionContext context;

        Smooks smooks = new Smooks();

        smooks.addVisitor(new Bean(MyBean.class, "myBeanData", "c").bindTo("x", "c/@x"));
        smooks.addVisitor(
                new FreeMarkerTemplateProcessor(
                        new TemplatingConfiguration("<mybean>${myBeanData.x}</mybean>").setUsage(BindTo.beanId("mybeanTemplate"))
                ),
                "c"
View Full Code Here

        ExecutionContext context;

        Smooks smooks = new Smooks();

        smooks.addVisitor(new Bean(MyBean.class, "myBeanData", "c").bindTo("x", "c/@x"));
        smooks.addVisitor(
                new FreeMarkerTemplateProcessor(
                        new TemplatingConfiguration("<mybean>${myBeanData.x}</mybean>").setUsage(BindTo.beanId("mybeanTemplate"))
                ),
                "c"
        );
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.