[jdom-interest] Inconsistancy in Namespace.hashCode().

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Mar 3 19:03:51 PST 2001


At 2:42 PM -0800 3/3/01, Jason Hunter wrote:


>Hmm... I can see both sides.  The counterargument to yours is that for
>all other objects in JDOM we define equals() as ==, for good reasons
>that I'll vigorously defend.  Thus two <foo/> elements are not equals()
>unless they're the same element object instance.  Same with attributes.
>Why should Namespace be different?

Because in the implicit JDOM data model, a namespace is not a node. 
It is a property of a node. Although two different set elements are 
not equal, their names are equal (as compared by String.equals()). 
Similarly, if the two elements are in the same namespace, then the 
namespaces of the elements should be equal.   I think the namespace 
is more analogous to the name of an element than to the element 
itself.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list