You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2004/01/18 18:39:37 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/dom ElementImpl.java
elena 2004/01/18 09:39:37
Modified: java/src/org/apache/xerces/dom ElementImpl.java
Log:
Fixing bug #21859
Revision Changes Path
1.64 +16 -3 xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java
Index: ElementImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- ElementImpl.java 17 Nov 2003 19:48:52 -0000 1.63
+++ ElementImpl.java 18 Jan 2004 17:39:36 -0000 1.64
@@ -687,8 +687,21 @@
attributes.setNamedItemNS(newAttr);
}
else {
- // change prefix and value
- ((AttrNSImpl)newAttr).name= (prefix!=null)?(prefix+":"+localName):localName;
+ if (newAttr instanceof AttrNSImpl){
+ // change prefix and value
+ ((AttrNSImpl)newAttr).name= (prefix!=null)?(prefix+":"+localName):localName;
+ }
+ else {
+ // This case may happen if user calls:
+ // elem.setAttribute("name", "value");
+ // elem.setAttributeNS(null, "name", "value");
+ // This case is not defined by the DOM spec, we choose
+ // to create a new attribute in this case and remove an old one from the tree
+ // note this might cause events to be propagated or user data to be lost
+ newAttr = new AttrNSImpl((CoreDocumentImpl)getOwnerDocument(), namespaceURI, qualifiedName, localName);
+ attributes.setNamedItemNS(newAttr);
+ }
+
newAttr.setNodeValue(value);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org