SAX2: Namespace Processing and NSUtils helper class
uche.ogbuji at fourthought.com
uche.ogbuji at fourthought.com
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
>
> {"http://www.w3.org/1999/xhtml", "a", ""}
>
> equals()
>
> {"http://www.w3.org/1999/xhtml", "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 {"http://www.w3.org/1999/xhtml", "a",
""} == {"http://www.w3.org/1999/xhtml", "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 fourthought.com (970)481-0805
Software engineering, project management, Intranets and Extranets
http://FourThought.com http://OpenTechnology.org
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list