Is there a way to tell the splitter-xpath to copy all parent namespaces to
the splitted element?

This is what I am trying to do:

I am trying to split an XML message with XPath, this message has a schema
defining an element containing a sequence of xsi:anySimpleType. Creating
such message gives me something like:

<alpha:root xmlns:alpha="http://test.com/Alpha"; xmlns:beta="
http://test.com/Beta";>
    <alpha:collection>
        <alpha:item xsi:type="beta:BetaItem" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";>
            <beta:name>Foo</beta:name>
        </alpha:item>
        <alpha:item xsi:type="beta:BetaItem" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";>
            <beta:name>Bar</beta:name>
        </alpha:item>
    </alpha:collection>
</alpha:root>


my camel route is:

<camelContext xmlns:alpha="http://test.com/Alpha"; xmlns:beta="
http://test.com/Beta"; >
    <route>
        <from uri="..."/>
        <split>
            <xpath>//alpha:item</xpath>
            <convertBodyTo type="java.lang.String"/>
            <to uri="log:output-missing-beta-namespace"/>
        </split>
    </route>
</camelContext>


feeding this route with the previous XML gives me 2 pieces of invalid XML
messages without the 'beta' namespace defined in the root element:

<alpha:item xmlns:alpha="http://test.com/Alpha"; xsi:type="beta:BetaItem"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
    <beta:name>Foo</beta:name>
</alpha:item>

So, Is there a way to tell the splitter-xpath to copy the 'beta' namespace
from 'root' declaration into the splitted 'alpha:item' element?


Thanks
*Henrique Viecili*

Reply via email to