SAX2: Namespace Processing and NSUtils helper class

uche.ogbuji at uche.ogbuji at
Sun Dec 26 20:51:22 GMT 1999

> To make this really useful, however, we should add equals(), intern(),
> and hashCode() methods, and that leads to a different (and trickier)
> should equals() and hashCode() consider the prefix, or not?  People
> will get really surprising results if 
>   {"", "a", ""}
> equals()
>   {"", "a", "html"}
> but it is counterintuitive that the two are not equal from a normal
> processing perspective.  Nasty business, really.

I think that though the prefix is maintained for convenience, it should _not_ 
be considered part of the name in any comparison at the semantic level.

DOM L2 exposes the prefix as well, but users who need to compare node names at 
the semantic level should use node.localName and node.namespaceURI strictly, 
and leave node.nodeName alone.

So, in short, I don't see a problem with {"", "a", 
""} == {"", "a", "html"}.  It's a very 
well-documented consequence of XML Namespaces 1.0, and users should be aware 
of it.

Uche Ogbuji
FourThought LLC, IT Consultants
uche.ogbuji at	(970)481-0805
Software engineering, project management, Intranets and Extranets

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list