pwnguin has asked for the wisdom of the Perl Monks concerning the following question:
Original File:
Patch File:<NODEA> <NODEB UID="111" > <NODEC name="1" > <NODED> text1 </NODED> <NODED> text2 </NODED> </NODEC> </NODEB> <NODEB UID="222" > <NODEC name="2" > <NODED> text1 </NODED> <NODED> text2 </NODED> </NODEC> </NODEB> </NODEA>
Merged File:<NODEA> <NODEB UID="111" > <NODEC name="1" > <NODED> patched text 1 </NODED> <NODED> patched text 2 </NODED> </NODEC> </NODEB> <NODEB UID="333" > <NODEC name="3" > <NODED> text1 </NODED> <NODED> text2 </NODED> </NODEC> </NODEB> </NODEA>
I would really appreciate any pointers on what libraries I could use for this, or if there is anything else like XML::Merge that I may have missed. I am thinking of using XML::Twig and to manually build up an array of nodes and compare them (although that sound really messy), but wanted to hear any ideas before I got started.<NODEA> <NODEB UID="111" > <NODEC name="1" > <NODED> patched text 1 </NODED> <NODED> patched text 2 </NODED> </NODEC> </NODEB> <NODEB UID="222" > <NODEC name="2" > <NODED> text1 </NODED> <NODED> text2 </NODED> </NODEC> </NODEB> <NODEB UID="333" > <NODEC name="3" > <NODED> text1 </NODED> <NODED> text2 </NODED> </NODEC> </NODEB> </NODEA>
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Merging two XML files (with conflicts)
by BrowserUk (Patriarch) on Feb 06, 2012 at 21:58 UTC | |
by pwnguin (Initiate) on Feb 06, 2012 at 22:57 UTC | |
|
Re: Merging two XML files (with conflicts)
by choroba (Cardinal) on Feb 07, 2012 at 00:14 UTC | |
by CountZero (Bishop) on Feb 07, 2012 at 10:47 UTC |