Extensible Xml Diff with SWI-Prolog
The previous article presented 2 alternatives for calculating the diff predicates, such as diff(on(//'NEST', @type), from(//bird, @name)). using a common strategy for matching objects, and a different strategy for matching sub-nodes of these objects, in the tree_d2_map and tree_d2_lcs implementations respectively. This approach led however to some code duplication, and thus to the increase of the number of predicates which one might have to write to produce a diff. The present article now introduces a generic diff implementation that works as a “swiss-army knife”, enabling on-the-spot combinations of node set matching strategies. Resources for this article Prolog source code and XML examples are available on [github] , and are linked to this article. To help enhance the readability of the predicates’ output, some Xml elements below are sometimes “ellipsed” with a “…” . A new code structure for decoupling th...