You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Henry Zongaro <zo...@ca.ibm.com> on 2005/03/28 21:24:05 UTC
QName.equals method
Hello.
Does anybody know why the equals method of
org.apache.xalan.xsltc.compiler.QName is based on an "==" comparison
instead of performing "equals" on the local names and namespace URIs of
the comparands?
The class overrides the default hashCode method so that any two QName
objects with the same local name and namespace URI will have the same
hashcode, but the implementation of the equals method prevents one from
using a QName object to get at a value stored in a hash table using a
different instance of QName.
The implementations of the two methods don't seem to complement one
another. They've been that way since the initial contribution of XSLTC by
Sun.
Thanks,
Henry
------------------------------------------------------------------
Henry Zongaro Xalan development
IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: QName.equals method
Posted by Brian Minchau <mi...@ca.ibm.com>.
Henry,
if that equals method of org.apache.xalan.xsltc.compiler.QName that is
based on an "==" comparison is correct, but depends on a QName reuse pool
mechanism, it would hurt to add a comment in the code about that dependancy
where the "==" is.
- Brian
- - - - - - - - - - - - - - - - - - - -
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: QName.equals method
Posted by Morris Kwan <mk...@ca.ibm.com>.
A QName reuse pool mechanism is implemented in
org.apache.xalan.xsltc.compiler.Parser. Please look at the fields _qNames,
_namespaces and the method
public QName getQName(String namespace, String prefix, String localname).
Regards,
Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: mkwan@ca.ibm.com
Henry
Zongaro/Toronto/I
BM@IBMCA To
xalan-dev@xml.apache.org
03/28/2005 02:24 cc
PM
Subject
QName.equals method
Please respond to
xalan-dev
Hello.
Does anybody know why the equals method of
org.apache.xalan.xsltc.compiler.QName is based on an "==" comparison
instead of performing "equals" on the local names and namespace URIs of
the comparands?
The class overrides the default hashCode method so that any two QName
objects with the same local name and namespace URI will have the same
hashcode, but the implementation of the equals method prevents one from
using a QName object to get at a value stored in a hash table using a
different instance of QName.
The implementations of the two methods don't seem to complement one
another. They've been that way since the initial contribution of XSLTC by
Sun.
Thanks,
Henry
------------------------------------------------------------------
Henry Zongaro Xalan development
IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: QName.equals method
Posted by Joseph Kesselman <ke...@us.ibm.com>.
I expect that someone implemented a QName reuse pool and the == reflects
that. (QNames need to bind uniquely to Expanded Types, so there certainly
ought to be code which is checking existing entries and ensuring a 1:1
relationship.)
I don't remember offhand where that might be being enforced.
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org