use of org.apache.camel.builder.xml.Namespaces in project camel by apache.
the class SplitterWithXqureyTest method createRouteBuilder.
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");
}
};
}
use of org.apache.camel.builder.xml.Namespaces in project camel by apache.
the class XPathWithNamespaceBuilderFilterAndResultTypeTest method createRouteBuilder.
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
}
};
}
use of org.apache.camel.builder.xml.Namespaces in project camel by apache.
the class XPathWithNamespaceBuilderFilterTest method createRouteBuilder.
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
}
};
}
use of org.apache.camel.builder.xml.Namespaces in project camel by apache.
the class XPathWithNamespacesFilterTest method createRouteBuilder.
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
}
};
}
use of org.apache.camel.builder.xml.Namespaces in project camel by apache.
the class XMLTokenSplitTest method createRouteBuilder.
@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().xtokenize("//orders/order", ns).to("mock:split");
// END SNIPPET: e1
from("file:target/xtokenizer2").split(body().xtokenize("//orders/order", ns)).to("mock:split");
}
};
}
Aggregations