Examples of addVisitor()


Examples of org.milyn.Smooks.addVisitor()

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

        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

    public void test_ChangeNamespace_2(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().setAttribute(new QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xxx", "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);

        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().setAttribute(new QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xxx", "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);

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

Examples of org.milyn.Smooks.addVisitor()

  public void test_SAX_01() throws SAXException, IOException {
    Smooks smooks = new Smooks();
    StringResult result = new StringResult();
   
    smooks.addVisitor(new DefaultSAXElementSerializer(), "#document");
    smooks.addVisitor(new DefaultSAXElementSerializer(), "#document/**");
    smooks.setFilterSettings(new FilterSettings().setDefaultSerializationOn(false).setFilterType(StreamFilterType.SAX));
   
    smooks.filterSource(new StreamSource(getClass().getResourceAsStream("order.xml")), result);
   
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

  public void test_SAX_01() throws SAXException, IOException {
    Smooks smooks = new Smooks();
    StringResult result = new StringResult();
   
    smooks.addVisitor(new DefaultSAXElementSerializer(), "#document");
    smooks.addVisitor(new DefaultSAXElementSerializer(), "#document/**");
    smooks.setFilterSettings(new FilterSettings().setDefaultSerializationOn(false).setFilterType(StreamFilterType.SAX));
   
    smooks.filterSource(new StreamSource(getClass().getResourceAsStream("order.xml")), result);
   
    assertOK("expected_01.xml", result);       
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

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

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setAttribute(new QName("xxx"), "${injectedVal}"), "a");

        ExecutionContext execContext = smooks.createExecutionContext();
        execContext.getBeanContext().addBean("injectedVal", "something");

        smooks.filterSource(execContext, new StringSource("<a/>"), result);
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

  public void test_SAX_02() throws SAXException, IOException {
    Smooks smooks = new Smooks();
    StringResult result = new StringResult();
   
    smooks.addVisitor(new DefaultSAXElementSerializer(), "customer");
    smooks.addVisitor(new DefaultSAXElementSerializer(), "customer/**");
    smooks.setFilterSettings(new FilterSettings().setDefaultSerializationOn(false).setFilterType(StreamFilterType.SAX));
   
    smooks.filterSource(new StreamSource(getClass().getResourceAsStream("order.xml")), result);
   
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

  public void test_SAX_02() throws SAXException, IOException {
    Smooks smooks = new Smooks();
    StringResult result = new StringResult();
   
    smooks.addVisitor(new DefaultSAXElementSerializer(), "customer");
    smooks.addVisitor(new DefaultSAXElementSerializer(), "customer/**");
    smooks.setFilterSettings(new FilterSettings().setDefaultSerializationOn(false).setFilterType(StreamFilterType.SAX));
   
    smooks.filterSource(new StreamSource(getClass().getResourceAsStream("order.xml")), result);
   
    assertOK("expected_02.xml", result);       
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

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

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setAttribute(new QName("http://www.w3.org/2000/xmlns/", "ns1", "xmlns"), "http://ns1").
                                               setAttribute(new QName("http://ns1", "xxx", "ns1"), "${injectedVal}"), "a");

        ExecutionContext execContext = smooks.createExecutionContext();
        execContext.getBeanContext().addBean("injectedVal", "something");
View Full Code Here

Examples of org.milyn.Smooks.addVisitor()

  public void test_SAX_03() throws SAXException, IOException {
    Smooks smooks = new Smooks();
    StringResult result = new StringResult();
   
    smooks.addVisitor(new DefaultSAXElementSerializer(), "items");
    smooks.addVisitor(new DefaultSAXElementSerializer(), "items/**");
    smooks.setFilterSettings(new FilterSettings().setDefaultSerializationOn(false).setFilterType(StreamFilterType.SAX));
   
    smooks.filterSource(new StreamSource(getClass().getResourceAsStream("order.xml")), 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.