Simples Assim

How to Evaluate XPath Expressions in Custom Processors in Apache Camel 1.6.2

leave a comment »

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.builder.xml.Namespaces;

public final class SampleRouteBuilder extends RouteBuilder {
  private static final Namespaces NS = new Namespaces("Sample", "http://fernandoribeiro.eti.br/Sample");

  @Override
  public void configure() throws Exception {
    from(...).process(new Processor() {

      public void process(final Exchange exchange) {
        final String str = (String) NS.xpath("/Sample:Element", String.class).evaluate(exchange);

        ...
      }

    });
  }

}

Advertisement

Written by Fernando Ribeiro

June 21, 2010 at 12:05 am

Posted in Software

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 781 other followers