当前位置: 首页>>代码示例>>Java>>正文


Java Namespaces类代码示例

本文整理汇总了Java中org.apache.camel.builder.xml.Namespaces的典型用法代码示例。如果您正苦于以下问题:Java Namespaces类的具体用法?Java Namespaces怎么用?Java Namespaces使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Namespaces类属于org.apache.camel.builder.xml包,在下文中一共展示了Namespaces类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            // lets define the namespaces we'll need in our filters
            Namespaces ns = new Namespaces("c", "http://acme.com/cheese")
                    .add("xsd", "http://www.w3.org/2001/XMLSchema");

            // now lets create an xpath based Message Filter
            from("direct:start").
                    filter(ns.xpath("/c:person[@name='James']", String.class)).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:XPathWithNamespaceBuilderFilterAndResultTypeTest.java

示例2: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            // lets define the namespaces we'll need in our filters
            Namespaces ns = new Namespaces("c", "http://acme.com/cheese")
                    .add("xsd", "http://www.w3.org/2001/XMLSchema");

            // now lets create an xpath based Message Filter
            from("direct:start").
                    filter(ns.xpath("/c:person[@name='James']")).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:XPathWithNamespaceBuilderFilterTest.java

示例3: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("", "http:acme.com");
        @Override
        public void configure() throws Exception {
            // START SNIPPET: e1
            from("file:target/pair")
                    // split the order child tags, and inherit namespaces from the orders root tag
                    .split().xtokenize("//order", 'i', ns, 2)
                    .to("log:split")
                    .to("mock:split");
            // END SNIPPET: e1
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:SplitGroupMultiXmlTokenTest.java

示例4: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("", "http:acme.com");
        @Override
        public void configure() throws Exception {
            // START SNIPPET: e1
            from("file:target/pair")
                    // split the order child tags, and inherit namespaces from the orders root tag
                    .split().xtokenize("//order", 'w', ns, 2)
                    .to("log:split")
                    .to("mock:split");
            // END SNIPPET: e1
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:SplitGroupWrappedMultiXmlTokenTest.java

示例5: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("", "http:acme.com");
        @Override
        public void configure() throws Exception {
            // START SNIPPET: e1
            from("file:target/xtokenizer")
                // split the order child tags, and inherit namespaces from the orders root tag
                .split().xtokenize("//orders/order", ns)
                    .to("mock:split");
            // END SNIPPET: e1

            from("file:target/xtokenizer2")
                // split the order child tags, and inherit namespaces from the orders root tag
                .split(body().xtokenize("//orders/order", ns))
                    .to("mock:split");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:XMLTokenSplitTest.java

示例6: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // split the message with namespaces defined 
            Namespaces namespaces = new Namespaces("one", "http://camel.apache.org/schema/one");                
            from("direct:endpoint").split().xpath("//one:other", namespaces).to("mock:result");
            
            from("direct:toString").split().xpath("//one:other", namespaces)
                .process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        Element element = (Element) exchange.getIn().getBody();
                        String message = CxfUtils.elementToString(element);
                        exchange.getOut().setBody(message);
                    }
                })
                .to("mock:result");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:SplitterWithXqureyTest.java

示例7: createRouteForAsyncHelloRouteIn

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
/**
 * Route for asynchronous <strong>asyncHello</strong> input operation.
 * <p/>
 * Prerequisite: none
 * <p/>
 * Output: {@link AsyncHelloResponse}
 */
private void createRouteForAsyncHelloRouteIn() {
    Namespaces ns = new Namespaces("h", SyncHelloRoute.HELLO_SERVICE_NS);

    // note: mandatory parameters are set already in XSD, this validation is extra
    XPathValidator validator = new XPathValidator("/h:asyncHelloRequest", ns, "h:name");

    // note: only shows using but without any influence in this case
    Expression nameExpr = xpath("/h:asyncHelloRequest/h:name").namespaces(ns).stringResult();

    AsynchRouteBuilder.newInstance(ServiceEnum.HELLO, OPERATION_NAME,
            getInWsUri(new QName(SyncHelloRoute.HELLO_SERVICE_NS, "asyncHelloRequest")),
            new AsynchResponseProcessor() {
                @Override
                protected Object setCallbackResponse(CallbackResponse callbackResponse) {
                    AsyncHelloResponse res = new AsyncHelloResponse();
                    res.setConfirmAsyncHello(callbackResponse);
                    return res;
                }
            }, jaxb(AsyncHelloResponse.class))

            .withValidator(validator)
            .withObjectIdExpr(nameExpr)
            .build(this);
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:32,代码来源:AsyncHelloRoute.java

示例8: testQueryTransform

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
@Test
public void testQueryTransform() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Namespaces ns = new Namespaces("ns", "http://org/wildfly/test/jaxb/model/Customer");
            from("direct:start").transform().xquery("/ns:customer/ns:firstName", String.class, ns)
            .to("mock:result");
        }
    });

    camelctx.start();
    try {
        //System.out.println(readCustomerXml());
        ProducerTemplate producer = camelctx.createProducerTemplate();
        String customer = producer.requestBody("direct:start", readCustomerXml("/customer.xml"), String.class);
        Assert.assertEquals("John", customer);
    } finally {
        camelctx.stop();
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:24,代码来源:XSLTIntegrationTest.java

示例9: xtokenize

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
/**
 * Evaluates an XML token expression on the message body with XML content
 * 
 * @param path the xpath like path notation specifying the child nodes to tokenize
 * @param mode one of 'i', 'w', or 'u' to inject the namespaces to the token, to
 *        wrap the token with its ancestor contet, or to unwrap to its element child
 * @param namespaces the namespace map to the namespace bindings 
 * @param group to group by the given number
 * @return the builder to continue processing the DSL
 */
public T xtokenize(String path, char mode, Namespaces namespaces, int group) {
    XMLTokenizerExpression expression = new XMLTokenizerExpression(path);
    expression.setMode(Character.toString(mode));
    expression.setNamespaces(namespaces.getNamespaces());

    if (group > 0) {
        expression.setGroup(group);
    }
    setExpressionType(expression);
    return result;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:ExpressionClauseSupport.java

示例10: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            Namespaces ns = new Namespaces("foo", "urn:cheese");

            from("direct:start").
                    unmarshal().string().
                    setHeader("foo", ns.xpath("/foo:person[@name='James']")).
                    filter(ns.xpath("/foo:person[@name='James']")).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:SetHeaderIssueTest.java

示例11: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            Namespaces ns = new Namespaces("c", "http://acme.com/cheese");

            from("direct:start").filter().
                    xpath("/c:person[@name='James']", ns).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:XPathWithNamespacesFilterTest.java

示例12: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // split the message with namespaces defined 
            Namespaces namespaces = new Namespaces("one", "http://camel.apache.org/schema/one");                
            from("direct:endpoint").split().xpath("//one:other", namespaces).to("mock:result");                
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:SplitterWithXqureyTest.java

示例13: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("file:target/xmltokenize")
                .split().xtokenize("//C:child", ns).streaming()
                    .to("mock:result")
                .end();
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:XMLTokenizeLanguageStreamingFileTest.java

示例14: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("direct:start")
                .split().xtokenize("//C:child", 'i', ns, 2)
                    .to("mock:result")
                .end();
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:XMLTokenizeLanguageGroupingTest.java

示例15: createRouteBuilder

import org.apache.camel.builder.xml.Namespaces; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("direct:start")
                .split().xtokenize("//C:child", 'w', ns)
                    .to("mock:result")
                .end();
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:XMLTokenizeWrapLanguageTest.java


注:本文中的org.apache.camel.builder.xml.Namespaces类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。