You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2007/07/18 14:48:42 UTC

svn commit: r557246 - /xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp

Author: amassari
Date: Wed Jul 18 05:48:42 2007
New Revision: 557246

URL: http://svn.apache.org/viewvc?view=rev&rev=557246
Log:
Send the NODE_CLONED notification for each node in the tree when cloning the entire DOMDocument (XERCESC-1722)

Modified:
    xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp

Modified: xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp?view=diff&rev=557246&r1=557245&r2=557246
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMDocumentImpl.cpp Wed Jul 18 05:48:42 2007
@@ -1038,7 +1038,7 @@
                 {
                     DOMAttr *attr = (DOMAttr *) srcattr->item(i);
                     if (attr -> getSpecified() || cloningDoc) { // not a default attribute or we are in the process of cloning the elements from inside a DOMDocumentType
-                        DOMAttr *nattr = (DOMAttr *) importNode(attr, true, false);
+                        DOMAttr *nattr = (DOMAttr *) importNode(attr, true, cloningDoc);
                         if (attr -> getLocalName() == 0)
                             newelement->setAttributeNode(nattr);
                         else
@@ -1134,14 +1134,14 @@
             DOMNamedNodeMap *tmap = newdoctype->getEntities();
             if(smap != 0) {
                 for(XMLSize_t i = 0; i < smap->getLength(); i++) {
-                    tmap->setNamedItem(importNode(smap->item(i), true, false));
+                    tmap->setNamedItem(importNode(smap->item(i), true, cloningDoc));
                 }
             }
             smap = srcdoctype->getNotations();
             tmap = newdoctype->getNotations();
             if (smap != 0) {
                 for(XMLSize_t i = 0; i < smap->getLength(); i++) {
-                    tmap->setNamedItem(importNode(smap->item(i), true, false));
+                    tmap->setNamedItem(importNode(smap->item(i), true, cloningDoc));
                 }
             }
             const XMLCh* intSubset=srcdoctype->getInternalSubset();
@@ -1159,7 +1159,7 @@
                     tmap = ((DOMDocumentTypeImpl *)newdoctype)->getElements();
                     if (smap != 0) {
                         for(XMLSize_t i = 0; i < smap->getLength(); i++) {
-                            tmap->setNamedItem(importNode(smap->item(i), true, true));
+                            tmap->setNamedItem(importNode(smap->item(i), true, cloningDoc));
                         }
                     }
                 }
@@ -1196,7 +1196,7 @@
              srckid != 0;
              srckid = srckid->getNextSibling())
         {
-            newnode->appendChild(importNode(srckid, true, false));
+            newnode->appendChild(importNode(srckid, true, cloningDoc));
         }
 
     if (newnode->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE
@@ -1205,7 +1205,13 @@
         errorChecking = oldErrorCheckingFlag;
     }
 
-    if (!cloningDoc)
+    if (cloningDoc)
+    {
+        // we know for sure that the source node is a DOMNodeImpl, as cloningDoc is set to true when
+        // a DOMDocumentImpl is cloned
+        castToNodeImpl(source)->callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, source, newnode);
+    }
+    else
         fNode.callUserDataHandlers(DOMUserDataHandler::NODE_IMPORTED, source, newnode);
 
     return newnode;



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