Any other experiences or hints for how to diff two XML files using Perl?
You've got some replies to this one on the CB, which you seemed to have ignored.
The simplest possible way is to pretty-print both XML files in the same way, and use a regular text-diff tool (like diff -u on Unix).
You might get better answers if you tell us what you need the diff for.
| [reply] [d/l] |
I haven't experienced the problem you describe with XML::Diff. The problem I have experienced is that the output is overly verbose. E.g., if you just change a few attributes, then the output is straight forward. But if you insert or delete a node, then you get a lot of node "updates" and "moves" along with the inserts or deletes (i.e. the changes are not optimal/minimal). But from what I've seen, you do get an accurate "patch" that will change the old file into the new file (which is what it says it does).
XML::SemanticDiff does what it says, and seems to give a simpler set of changes for simple inserts and deletes of nodes. It's not meant to generate a patch like XML::Diff does, though you might be able to make one with a custom handler. There's an example of how to use the module in the docs. However, the pod for the docs appears to be broken right now (for me on 5.10 and on CPAN), so you may have to look in the source code for the docs. If you, e.g., delete an element with attributes, and you want a full description of the element and the attributes, you'll have to use the custom diff handler interface to get at those attributes. The basic default handler does work as advertised in the docs though.
| [reply] |
the pod for the docs appears to be broken right now (for me on 5.10 and on CPAN)
The XML::SemanticDiff module maintainer just released version 1.0000 to CPAN in response to a patch I submitted last night for a POD error in version 0.99. Now, the following will correctly show the POD contents:
perldoc XML::SemanticDiff
| [reply] [d/l] |
There is quite a bit of discussion and usage discussion if you search google for "XML::SemanticDiff"
| [reply] |
Dear Monks,
Thanks for all the responses, and sorry I missed the response in the chatterbox. I'm new to this forum (& how to use the chatterbox).
While google searching down some of your suggestions, I came across this page:
http://xmltwig.com/article/ways_to_rome/ways_to_rome.html
which I thought some might find helpful.
Thanks again! | [reply] |