[jdom-interest] hashCode() and equals()

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Jun 2 15:43:58 PDT 2001

At 6:09 PM -0400 6/2/01, Amy Lewis wrote:

>Again, correct.  But!
>The "but" in both cases is that the namespace is referred-to, using the
>prefix, in an attribute value.  If I understand the way that JDOM's
>namespaces currently work, "prefixes are not important," which is
>spec-compliant, but in fact, inside a document in which a prefix is
>declared, not only the prefixes attached to elements may need to
>change, but *also* the prefixes within embedded XPaths or schema
>type-definition references may need to change.  Which means that the
>processor cannot safely make changes, unless it can track the content
>of attribute values to make certain that these have changed as well.

No but. We dealt with this six months ago. JDOM never changes the 
namespace prefix. All namespace prefixes are preserved inside or 
outside of element names, attribute values, and text content. All 
namespace contexts are preserved, even when elements and attributes 
are removed from their documents. I suppose there's small chance that 
if an attribute value were removed from its document it could lose 
its context, and that would be bad, but that's pretty rare.

The main problem here is that namespaces are confusing. I think when 
most people run up against trouble with namespaces in the JDOM API 
it's because they have an incorrect mental model of how namespaces 
actually work. I think JDOM is very close to as intuitive as its 
possible to be given the confusing nature of Namespaces in XML.


| 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