[EMAIL PROTECTED] wrote:
In the element ElementProxy class, the
guaranteeThatElementInCorrectSpace method doesn't to
have the expected behavior :
String localnameSHOULDBE = this.getBaseLocalName();
String namespaceSHOULDBE = this.getBaseNamespace();
String localnameIS =
this._constructionElement.getLocalName();
String namespaceIS =
this._constructionElement.getNamespaceURI();
if (!localnameSHOULDBE.equals(localnameIS)||
!namespaceSHOULDBE.equals(namespaceSHOULDBE))
{
(...)
}
I think the condition should read :
if (!localnameSHOULDBE.equals(localnameIS)||
!namespaceSHOULDBE.equals(namespaceIS))
{
(...)
}
Correct. I have fixed this.
Furthermore, I'd like to know your mind about a slight
change.
Coded as it is now, there can be a NPE issued when
trying to compare two namespaces.
I think (but I'm not sure) that a null namespace is
supposed to represent the default XML namespace and
thus, is a legal value. Therefore, I propose a little
rewrite of this to allow null namespaces.
But well, maybe it's just not supposed to happen at
all.
However the W3C's Element interface's getNamespaceURI
method states that it returns "the namespace URI of
this node, or null if it is unspecified."
Right, but namespaceSHOULDBE should never be null, so even if
namespaceIS is null, the condition will evaluate to false because
namespaceSHOULDBE.equals(null) will evaluate to false.
--Sean