Hello everyone, here's a greenhorn in need of advice.
Recently, I've come up on a situation where I should compare two XMLs but in a somewhat non-standard way, so let me briefly describe the current specification.
Consider two XMLs, A and B.
Let us denote A a "comparison XML" and B a "reference XML".
The comparison C that I need to construct is basically described with relation C = A ⊆B, and it should return a boolean operator: true for case when C holds, and false otherwise. So, the way I see it - whenever I find a node in A that is not in B, or is "semantically-different" from reference node in B, we should return false and terminate immediately.
Let me give a brief example:
So, for this case C should return
true:
Observe the ordering in B node - if complete ordering inside a node is permutated, we consider it to be "semantically-equivalent" with reference XML.
This case would see C return
false:
Also, trivially, C would also return
false in this case:
So, since I am very fresh with XMLUtil (I discovered it just yesterday), I would basically need a few pointers (pardon me, references
) from people knowledgeable with XMLUtil API:
- what interfaces should I override? First MatchTracker comes to mind with its methods matchFound() and printNode() (it would be nice to see where A differs on B, but it's not mandatory),
- if possible, guesstimate how much work and implementation would this ensue? More specifically, would I be better off constructing the algorithm myself if it would take too much time to fiddle with API (DifferenceEngine) in order to get this thing done?
Also, great help would be to make XMLUtil perform comparisons one-way only, i.e. to report differences in direction A -> B, not the other way around.
Any other insight regarding this is also appreaciated.
Thank you very much for your time.