You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/01/16 05:12:45 UTC

DO NOT REPLY [Bug 16154] New: - setAttributeNS has incorrect behavior for null prefix, EASY TO FIX

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16154>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16154

setAttributeNS has incorrect behavior for null prefix, EASY TO FIX

           Summary: setAttributeNS has incorrect behavior for null prefix,
                    EASY TO FIX
           Product: Xerces2-J
           Version: 2.2.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: DOM
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: sdb@webalo.com


For an element, el, that already has an attribute with prefix == null (i.e.
qualified name has no ':' in it), calling
 
el.setAttributeNS(same namespace as existing attr, qualified name of existing
attr, some new value) 

should not change the qualified name (per the dom specsince the prefix of the
new qualified name is also null), however, for Xerces2-J 2.2.1, the qualified
name gets the name "null:" prepended to it.

The offending line is, appropriately, org.apache.xerces.dom.ElementImpl.java:666

This line is is:
((AttrNSImpl)newAttr).name= prefix+":"+localName;

It could be changed to, for example:
((AttrNSImpl)newAttr).name= ((prefix == null) ? "" : (prefix+":"))+localName;

thanks,
Seth

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org