[jdom-interest] XML equivalence

Neil neil at ipdevco.com
Thu Aug 14 06:55:40 PDT 2003


When I first read the following in the FAQ, I was a little surprised,
although it makes perfect sense.

>Why does equals() only do a == check?
>
>In JDOM two objects are only equal if they're the exact same object. This
lets a call like
>list.remove(elem) remove only the exact Element passed in, not any element
that's equivalent. 
>This's a very important distinction. Doing a full equals() on an Element
would require recursing 
>down the tree, and in general we believe it unlikely you'll want to know if
this element and all 
>its children are equivalent to another one. If you really do want to know
you can write some 
>comparison code yourself that checks only as much as you want to check
(maybe the 
>name/namespaces only) instead of doing a full recurse.
  
However, since I've been using JDOM, I've now twice wanted to be able to do
true equivalence checking.  I must not be the only one.

Have any contributors worked on this or are working on this?  Maybe it's
time for me to do some contributing, but I'm not sure my XML sophistication
is great enough.  I'm pretty much just a surface level user of XML, though
I'm experienced with java frameworks and design.

Any comments?


Neil Brandt










More information about the jdom-interest mailing list