[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-cvs
Subject: cvs commit: xml-xerces/c/src/dom DocumentImpl.cpp
From: tng () apache ! org
Date: 2001-12-21 16:59:12
[Download RAW message or body]
tng 01/12/21 08:59:12
Modified: c/src/dom DocumentImpl.cpp
Log:
[Bug 5365] DocumentImpl::importNode does not delete old attribute if
its reference count equals zero. Fixed by Frank Balluffi.
Revision Changes Path
1.39 +24 -15 xml-xerces/c/src/dom/DocumentImpl.cpp
Index: DocumentImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentImpl.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- DocumentImpl.cpp 2001/12/07 01:35:28 1.38
+++ DocumentImpl.cpp 2001/12/21 16:59:12 1.39
@@ -55,7 +55,7 @@
*/
/*
- * $Id: DocumentImpl.cpp,v 1.38 2001/12/07 01:35:28 tng Exp $
+ * $Id: DocumentImpl.cpp,v 1.39 2001/12/21 16:59:12 tng Exp $
*/
//
@@ -515,27 +515,36 @@
switch (source->getNodeType())
{
- case DOM_Node::ELEMENT_NODE :
+ case DOM_Node::ELEMENT_NODE :
{
ElementImpl *newelement;
- if (source->getLocalName() == null)
- newelement = createElement(source->getNodeName());
- else
- newelement = createElementNS(source->getNamespaceURI(),
+ if (source->getLocalName() == null)
+ newelement = createElement(source->getNodeName());
+ else
+ newelement = createElementNS(source->getNamespaceURI(),
source->getNodeName());
NamedNodeMapImpl *srcattr=source->getAttributes();
- if(srcattr!=null)
+ if (srcattr!=null)
for(unsigned int i=0;i<srcattr->getLength();++i)
- {
- AttrImpl *attr = (AttrImpl *) srcattr->item(i);
- if (attr -> getSpecified()) { // not a default attribute
+ {
+ AttrImpl *attr = (AttrImpl *) srcattr->item(i);
+ AttrImpl * pOldAttr = null;
+ if (attr -> getSpecified())
+ { // not a default attribute
AttrImpl *nattr = (AttrImpl *) importNode(attr, true);
- if (attr -> getLocalName() == null)
- newelement->setAttributeNode(nattr);
- else
- newelement->setAttributeNodeNS(nattr);
+ if (attr -> getLocalName() == null)
+ pOldAttr = newelement->setAttributeNode(nattr);
+ else
+ pOldAttr = newelement->setAttributeNodeNS(nattr);
+
+ if (pOldAttr)
+ {
+ if (pOldAttr->nodeRefCount == 0)
+ NodeImpl::deleteIf(pOldAttr);
+ }
}
- }
+ }
+
newnode=newelement;
}
break;
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic