• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

XMLUnit question

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Grow a forest with seedballs and this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic