You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ebinsingh <eb...@VerizonWireless.com> on 2012/04/25 15:09:16 UTC
Merge XML files
Hi All,
I am trying to merge two xml files of the same format (i.e they contain the
same Node's but different data).
I use the tokenizeXML and tokenizePair utilities.
But not sure how to include the herder in the output xml file.
E.g I have 2 xml files like the below ...
<?xml version="1.0" encoding="UTF-8"?>
<IPDRDoc xmlns="http://www.ipdr.org/namespaces/ipdr"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ipdr.org/namespaces/ipdr
EricssonIs835v1.11.xsd" seqNum="270" version="2.0">
<IPDRRec id="MEDIATION" startTime="2012-04-22T15:30:06"/>
<IPDR seqNum="22898" time="2012-04-22T16:02:02">
<SS service="UDR">
</SS>
</IPDR>
<IPDR seqNum="22890" time="2012-04-22T16:02:02">
<SS service="UDR">
</SS>
</IPDR>
<IPDR seqNum="22891" time="2012-04-22T16:02:02">
<SS service="UDR">
</SS>
</IPDR>
<IPDRDoc.End count="25" endTime="2012-04-22T16:10:04"/>
</IPDRDoc>
I need the output as ...
<?xml version="1.0" encoding="UTF-8"?>
<IPDRDoc xmlns="http://www.ipdr.org/namespaces/ipdr"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ipdr.org/namespaces/ipdr
EricssonIs835v1.11.xsd" seqNum="270" version="2.0">
<IPDR seqNum="22898" time="2012-04-22T16:02:02">
<SS service="UDR">
</SS>
</IPDR>
<IPDR seqNum="22890" time="2012-04-22T16:02:02">
<SS service="UDR">
</SS>
</IPDR>
<IPDR seqNum="22891" time="2012-04-22T16:02:02">
<SS service="UDR">
</SS>
</IPDR>
</IPDRDoc>
With the tokenizeXML and tokenizePair as mentione in Claus Isben's blog
(http://davsclaus.blogspot.com/2011/11/splitting-big-xml-files-with-apache.html),
I was not able to get the below part of the xml into the output.
Appreciate your help.
<?xml version="1.0" encoding="UTF-8"?>
<IPDRDoc xmlns="http://www.ipdr.org/namespaces/ipdr"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ipdr.org/namespaces/ipdr
EricssonIs835v1.11.xsd" seqNum="270" version="2.0">
Thanks & regards,
Ebe
--
View this message in context: http://camel.465427.n5.nabble.com/Merge-XML-files-tp5664818p5664818.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Merge XML files
Posted by ebinsingh <eb...@VerizonWireless.com>.
Thanks a lot Marco. It was what I was looking for. I had to pass the output
from Aggregator to a bean to wrap the aggregator output insise the header
and footer nodes.
Best regards,
Ebe
--
View this message in context: http://camel.465427.n5.nabble.com/Merge-XML-files-tp5664818p5665474.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Merge XML files
Posted by Marco Westermann <Ma...@gmx.de>.
HI,
if I understand you correct, you miss the IPDRDoc-Element in the output
after you splitted the message by tokenizeXML("IPDR"), is that correct?
if you split a message by an xml-Element you will loose the
parent-elements of that element you split by.
What you can do is to aggregate the message after you splitted it. Then
in your AggregationStrategy, you add the missing IPDRDoc-Element.
regards, Marco
Am 25.04.2012 15:09, schrieb ebinsingh:
> Hi All,
>
> I am trying to merge two xml files of the same format (i.e they contain the
> same Node's but different data).
> I use the tokenizeXML and tokenizePair utilities.
>
> But not sure how to include the herder in the output xml file.
>
> E.g I have 2 xml files like the below ...
>
> <?xml version="1.0" encoding="UTF-8"?>
> <IPDRDoc xmlns="http://www.ipdr.org/namespaces/ipdr"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.ipdr.org/namespaces/ipdr
> EricssonIs835v1.11.xsd" seqNum="270" version="2.0">
> <IPDRRec id="MEDIATION" startTime="2012-04-22T15:30:06"/>
> <IPDR seqNum="22898" time="2012-04-22T16:02:02">
> <SS service="UDR">
> </SS>
> </IPDR>
> <IPDR seqNum="22890" time="2012-04-22T16:02:02">
> <SS service="UDR">
> </SS>
> </IPDR>
> <IPDR seqNum="22891" time="2012-04-22T16:02:02">
> <SS service="UDR">
> </SS>
> </IPDR>
> <IPDRDoc.End count="25" endTime="2012-04-22T16:10:04"/>
> </IPDRDoc>
>
> I need the output as ...
> <?xml version="1.0" encoding="UTF-8"?>
> <IPDRDoc xmlns="http://www.ipdr.org/namespaces/ipdr"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.ipdr.org/namespaces/ipdr
> EricssonIs835v1.11.xsd" seqNum="270" version="2.0">
> <IPDR seqNum="22898" time="2012-04-22T16:02:02">
> <SS service="UDR">
> </SS>
> </IPDR>
> <IPDR seqNum="22890" time="2012-04-22T16:02:02">
> <SS service="UDR">
> </SS>
> </IPDR>
> <IPDR seqNum="22891" time="2012-04-22T16:02:02">
> <SS service="UDR">
> </SS>
> </IPDR>
> </IPDRDoc>
>
>
> With the tokenizeXML and tokenizePair as mentione in Claus Isben's blog
> (http://davsclaus.blogspot.com/2011/11/splitting-big-xml-files-with-apache.html),
>
> I was not able to get the below part of the xml into the output.
> Appreciate your help.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <IPDRDoc xmlns="http://www.ipdr.org/namespaces/ipdr"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.ipdr.org/namespaces/ipdr
> EricssonIs835v1.11.xsd" seqNum="270" version="2.0">
>
>
> Thanks& regards,
> Ebe
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Merge-XML-files-tp5664818p5664818.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>