On Sun, Oct 30, 2011 at 9:38 PM, Christian Müller
<christian.muel...@gmail.com> wrote:
> This is a very good improvement. Thank you Claus!
>
> We should also have a "solution for the enterprise" users which often use
> namespaces like this:
> <records xmlns="http://foo"; xmlns:bar="http://bar";>
>  <record id="1">
>  </record>
>  <record id="2">
>  </record>
>  <record id="3">
>  </record>
>  ....
>  <record id="N">
>  </record>
> </records>
>
> After splitting the large XML files into its individual parts, we should
> have something like:
> <record id="1" xmlns="http://foo"; xmlns:bar="http://bar";>
> </record>
>

This is now supported using the tokenizeXML, for example in XML

  <camelContext xmlns="http://camel.apache.org/schema/spring";>
    <route>
      <from uri="file:target/pair"/>
      <split streaming="true">
        <!-- split the file using XML tokenizer, where we grab the record tag,
             and inherit the namespaces from the parent/root records tag
             the xml attribute must be set to true, to enable XML mode -->
        <tokenize token="record" inheritNamespaceTagName="records" xml="true"/>
        <to uri="mock:split"/>
      </split>
    </route>
  </camelContext>

In Java code you simply do

 from("file:target/pair")
                    .split().streaming().tokenizeXML("record", "records")
                        .to("mock:split");


> Best,
> Christian
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to