I would like to use an XML diff algorithm, but not have to re-invent the wheel. What I'd like to do is have something like this:
diff --differ xmldiff -N [other neat diff options] tree1 tree2 then have diff essentially just do the equivalent of "cmp" on each pair of files it ends up diffing, and then, if and only if the files differ, feed the inputs to the program differ, which should work like cmp (take two file names, return an exit code indicating difference or similarity), but provide arbitrary textual output. If the program specified decides that for its purposes the inputs don't differ, then diff will act as if the files were, after all, the same. Otherwise, it will include the differ program's output in its output. The first few lines indicating the names of the files being compared can still be generated by diff itself; indeed, should be, as in order to be able to supply empty files to the differ program, it may sometimes want to use /dev/null as an input to --differ, but of course that's not the filename one wants to print in the output. The example above could quite easily be extended to work with --from-file, --to-file and other options. Does anything like this exist? Would a patch that implements it be of interest? -- http://rrt.sc3d.org Astrophysics: it’s not exactly rocket science