Buggy code:
public class ElementImpl extends ParentNode implements Element { static final long serialVersionUID = 3717253516652722278L ; protected String name ; protected AttributeMap attributes ; public ElementImpl ( CoreDocumentImpl ownerDoc , String name ) { } protected ElementImpl ( ) { } void rename ( String name ) { } public short getNodeType ( ) { } public String getNodeName ( ) { } public NamedNodeMap getAttributes ( ) { } public Node cloneNode ( boolean deep ) { } public String getBaseURI ( ) { } void setOwnerDocument ( CoreDocumentImpl doc ) { } public String getAttribute ( String name ) { } public Attr getAttributeNode ( String name ) { } public NodeList getElementsByTagName ( String tagname ) { } public String getTagName ( ) { } public void normalize ( ) { } public void removeAttribute ( String name ) { } public Attr removeAttributeNode ( Attr oldAttr ) throws DOMException { } public void setAttribute ( String name , String value ) { } public Attr setAttributeNode ( Attr newAttr ) throws DOMException { } public String getAttributeNS ( String namespaceURI , String localName ) { } public void setAttributeNS ( String namespaceURI , String qualifiedName , String value ) { if ( ( ownerDocument . errorChecking ) && ( isReadOnly ( ) ) ) { String msg = DOMMessageFormatter . formatMessage ( DOM_DOMAIN , "NO_MODIFICATION_ALLOWED_ERR" , null ) ; throw new DOMException ( DOMException . NO_MODIFICATION_ALLOWED_ERR , msg ) ; } if ( needsSyncData ( ) ) { synchronizeData ( ) ; } int index = qualifiedName . indexOf ( ':' ) ; String prefix ; String localName ; if ( index < 0 ) { prefix = null ; localName = qualifiedName ; } else { prefix = qualifiedName . substring ( 0 , index ) ; localName = qualifiedName . substring ( ( index + 1 ) ) ; } Attr newAttr = getAttributeNodeNS ( namespaceURI , localName ) ; if ( newAttr == null ) { newAttr = getOwnerDocument ( ) . createAttributeNS ( namespaceURI , qualifiedName ) ; if ( ( attributes ) == null ) { attributes = new AttributeMap ( this , null ) ; } newAttr . setNodeValue ( value ) ; attributes . setNamedItemNS ( newAttr ) ; } else { <START_BUG> ( ( AttrNSImpl ) ( newAttr ) ) . name = ( prefix + ":" ) + localName ; <END_BUG> newAttr . setNodeValue ( value ) ; } } public void removeAttributeNS ( String namespaceURI , String localName ) { } public Attr getAttributeNodeNS ( String namespaceURI , String localName ) { } public Attr setAttributeNodeNS ( Attr newAttr ) throws DOMException { } protected int setXercesAttributeNode ( Attr attr ) { } public boolean hasAttributes ( ) { } public boolean hasAttribute ( String name ) { } public boolean hasAttributeNS ( String namespaceURI , String localName ) { } public NodeList getElementsByTagNameNS ( String namespaceURI , String localName ) { } public boolean isEqualNode ( Node arg ) { } public void setReadOnly ( boolean readOnly , boolean deep ) { } public void setIdAttributeNode ( Attr at ) { } protected void synchronizeData ( ) { } void moveSpecifiedAttributes ( ElementImpl el ) { } protected void setupDefaultAttributes ( ) { } protected void reconcileDefaultAttributes ( ) { } protected NamedNodeMapImpl getDefaultAttributes ( ) { } }

Fix:
( ( AttrNSImpl ) ( newAttr ) ) . name = ( prefix != null ) ? ( prefix + ":" ) + localName : localName ;