<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2655.35">
<TITLE>RE: [jdom-interest] XML equivalence</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>More than anything, I think you will discover that every person will have a different opinion as to when two elements are "equals"...</FONT></P>
<P><FONT SIZE=2>Are they equals with the same namespace/name, with "equals" elements in the content, etc...</FONT>
</P>
<P><FONT SIZE=2>Basically, there are too many ways in which elements can be considered equals (depends on how you want it to behave for your application). Putting any one application's specific "equals" code in to the JDom source would probably be counter-productive.</FONT></P>
<P><FONT SIZE=2>Rolf</FONT>
</P>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Neil [<A HREF="mailto:neil@ipdevco.com">mailto:neil@ipdevco.com</A>]</FONT>
<BR><FONT SIZE=2>Sent: Thursday, August 14, 2003 9:56 AM</FONT>
<BR><FONT SIZE=2>To: jdom-interest@jdom.org</FONT>
<BR><FONT SIZE=2>Subject: [jdom-interest] XML equivalence</FONT>
</P>
<BR>
<P><FONT SIZE=2>When I first read the following in the FAQ, I was a little surprised,</FONT>
<BR><FONT SIZE=2>although it makes perfect sense.</FONT>
</P>
<P><FONT SIZE=2>>Why does equals() only do a == check?</FONT>
<BR><FONT SIZE=2>></FONT>
<BR><FONT SIZE=2>>In JDOM two objects are only equal if they're the exact same object. This</FONT>
<BR><FONT SIZE=2>lets a call like</FONT>
<BR><FONT SIZE=2>>list.remove(elem) remove only the exact Element passed in, not any element</FONT>
<BR><FONT SIZE=2>that's equivalent. </FONT>
<BR><FONT SIZE=2>>This's a very important distinction. Doing a full equals() on an Element</FONT>
<BR><FONT SIZE=2>would require recursing </FONT>
<BR><FONT SIZE=2>>down the tree, and in general we believe it unlikely you'll want to know if</FONT>
<BR><FONT SIZE=2>this element and all </FONT>
<BR><FONT SIZE=2>>its children are equivalent to another one. If you really do want to know</FONT>
<BR><FONT SIZE=2>you can write some </FONT>
<BR><FONT SIZE=2>>comparison code yourself that checks only as much as you want to check</FONT>
<BR><FONT SIZE=2>(maybe the </FONT>
<BR><FONT SIZE=2>>name/namespaces only) instead of doing a full recurse.</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>However, since I've been using JDOM, I've now twice wanted to be able to do</FONT>
<BR><FONT SIZE=2>true equivalence checking. I must not be the only one.</FONT>
</P>
<P><FONT SIZE=2>Have any contributors worked on this or are working on this? Maybe it's</FONT>
<BR><FONT SIZE=2>time for me to do some contributing, but I'm not sure my XML sophistication</FONT>
<BR><FONT SIZE=2>is great enough. I'm pretty much just a surface level user of XML, though</FONT>
<BR><FONT SIZE=2>I'm experienced with java frameworks and design.</FONT>
</P>
<P><FONT SIZE=2>Any comments?</FONT>
</P>
<BR>
<P><FONT SIZE=2>Neil Brandt</FONT>
</P>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<P><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>To control your jdom-interest membership:</FONT>
<BR><FONT SIZE=2><A HREF="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com" TARGET="_blank">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com</A></FONT>
</P>
</BODY>
</HTML>