You can use a method call expression and call a method on a pojo. And
there use the tokenizexml language where you of course in java code
can compute the tag names.

public static Expression myTokenizeXML(String data) {
  // figure out the tag name
  return TokenizeLanguage.tokenizeXML(tagName, xxx);
}

split().method(MyTokenBean.class, "myTokenizeXML").streaming().

On Wed, Sep 18, 2013 at 11:07 AM, Tom Ellis <[email protected]> wrote:
> Hi Everyone,
>
> Is it possible to have a dynamic tagName parameter specified for the
> tokenizeXML function of the Tokenizer language?
>
> For example, say as part of a route I inspect a big incoming payload
> and determine that it is of type Orders, so wish to set my tagName as
> "order". However on the same route Parts could be sent, so I wish to
> tokenize based on the tagName "part".
>
> I was hoping that maybe I could build it using a Simple expression or
> something, e.g.
>
> from("file:inbox")
>   .beanRef("inspectPayload") // adds payloadTag to the exchange header
> which is the tag name we wish to tokenize on
>   .split().tokenizeXML("${in.payloadTag}").streaming()
>      .to("activemq:queue:tags");
>
> but from the code it seems that tokenizeXML uses the tagName specified
> to build the start and end tokens.
>
> Does anyone have any ideas on how I could do this without having to
> specify a route for each incoming type?
>
> Cheers,
>
> Tom



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to