ws-soap-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kesh...@us.ibm.com
Subject Re: Fw: Xerces 1.1.2 Bug
Date Wed, 19 Jul 2000 13:00:48 GMT
The described behavior is not a bug, per the DOM Level 2 Candidate
Recommendation.

The DOM's getAttributeNS() method behaves like getAttribute(). If an
attribute is not present and doesn't have a default value, it should return
an empty string.

If you want to distinguish this case, use getAttributeNodeNS() to obtain
the Attr object; this returns null if there isn't one.

You can obtain the requested behavior by saying something like:

     Attr tempAttr;
     String valueOrNull = ( (tempAttr=myNode.getAttributeNodeNS(...)) ==
null )
               : null
               ? tempAttr.getNodeValue();

(We can, and do, argue about whether having getAttribute return an empty
string was a good idea or not. But that decision was made in DOM Level 1,
and we decided that the new namespace-aware methods in Level 2 should
follow that behavior to avoid confusing users faimilar with the Level 1
calls.)

______________________________________
Joe Kesselman  / IBM Research



Mime
View raw message