Examples of addVisitor()


Examples of org.milyn.Smooks.addVisitor()

        // Set the Smooks instnace to use the DOM filter...
        smooks.setFilterSettings(FilterSettings.DEFAULT_DOM);

        // Add a SAX-only visitor
        smooks.addVisitor(new SAXVisitor01(), "a");

        try {
            smooks.filterSource(new StringSource("<a/>"));
            fail("Expected SmooksException.");
        } catch (SmooksException e) {
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

    public void test(FilterSettings filterSettings, boolean keepChildren, String expected) throws IOException, SAXException {
        Smooks smooks = new Smooks();
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new RemoveElement().setKeepChildren(keepChildren), "b");

        smooks.filterSource(new StringSource("<a><b><d><e>some text</e></d></b><something/></a>"), result);

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new StringReader(expected), new StringReader(result.getResult()));
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

    Smooks smooks = new Smooks();
    MyVisitBypass bypassVisitor = new MyVisitBypass(!expectBypass);
   
    smooks.setFilterSettings(filterSettings);
   
    smooks.addVisitor(bypassVisitor, selector);
    if(simpleVisitor != null) {
      smooks.addVisitor(simpleVisitor, "zz");
    }
   
    smooks.filterSource(new StringSource("<x/>"), new StringResult());
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

   
    smooks.setFilterSettings(filterSettings);
   
    smooks.addVisitor(bypassVisitor, selector);
    if(simpleVisitor != null) {
      smooks.addVisitor(simpleVisitor, "zz");
    }
   
    smooks.filterSource(new StringSource("<x/>"), new StringResult());
   
    assertEquals(expectBypass, bypassVisitor.bypassCalled);
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

    private void test_ChangeName(FilterSettings filterSettings) throws IOException, SAXException {
        Smooks smooks = new Smooks();
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setElementName("c"), "b");
        smooks.addVisitor(new SetElementData().setElementName("z"), "e");

        smooks.filterSource(new StringSource("<a><b><d><e>some text</e></d></b></a>"), result);

        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

        Smooks smooks = new Smooks();
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setElementName("c"), "b");
        smooks.addVisitor(new SetElementData().setElementName("z"), "e");

        smooks.filterSource(new StringSource("<a><b><d><e>some text</e></d></b></a>"), result);

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new StringReader("<a><c><d><z>some text</z></d></c></a>"), new StringReader(result.getResult()));
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

    private void test_SetNamespace(FilterSettings filterSettings) throws IOException, SAXException {
        Smooks smooks = new Smooks();
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setElementName("c"), "b");
        smooks.addVisitor(new SetElementData().setElementName("xxx:z").
                               setAttribute(new QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xxx", "xmlns"), "http://xxx"), "e");

        smooks.filterSource(new StringSource("<a><b><d><e>some text</e></d></b></a>"), result);
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

        Smooks smooks = new Smooks();
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setElementName("c"), "b");
        smooks.addVisitor(new SetElementData().setElementName("xxx:z").
                               setAttribute(new QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xxx", "xmlns"), "http://xxx"), "e");

        smooks.filterSource(new StringSource("<a><b><d><e>some text</e></d></b></a>"), result);

        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

    public void test_ChangeNamespace_1(FilterSettings filterSettings) throws IOException, SAXException {
        Smooks smooks = new Smooks();
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setElementName("c"), "b");
        smooks.addVisitor(new RemoveAttribute().setName("xmlns:xxx").setNamespace(XMLConstants.XMLNS_ATTRIBUTE_NS_URI), "z");
        smooks.addVisitor(new SetElementData().setElementNamespace("http://yyy").setElementName("yyy:z").
                               setAttribute(new QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "yyy", "xmlns"), "http://yyy"), "z");

        smooks.filterSource(new StringSource("<a><c><d><xxx:z xmlns:xxx=\"http://xxx\">some text</xxx:z></d></c></a>"), result);
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

        Smooks smooks = new Smooks();
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setElementName("c"), "b");
        smooks.addVisitor(new RemoveAttribute().setName("xmlns:xxx").setNamespace(XMLConstants.XMLNS_ATTRIBUTE_NS_URI), "z");
        smooks.addVisitor(new SetElementData().setElementNamespace("http://yyy").setElementName("yyy:z").
                               setAttribute(new QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "yyy", "xmlns"), "http://yyy"), "z");

        smooks.filterSource(new StringSource("<a><c><d><xxx:z xmlns:xxx=\"http://xxx\">some text</xxx:z></d></c></a>"), result);
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.