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 10:53:14 UTC

svn commit: r557202 - /xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp

Author: amassari
Date: Wed Jul 18 01:53:14 2007
New Revision: 557202

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

Modified:
    xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp?view=diff&rev=557202&r1=557201&r2=557202
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp Wed Jul 18 01:53:14 2007
@@ -1083,7 +1083,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
@@ -1180,14 +1180,14 @@
             DOMNamedNodeMap *tmap = newdoctype->getEntities();
             if(smap != 0) {
                 for(unsigned int 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(unsigned int 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();
@@ -1205,7 +1205,7 @@
                     tmap = newdoctype->getElements();
                     if (smap != 0) {
                         for(unsigned int i = 0; i < smap->getLength(); i++) {
-                            tmap->setNamedItem(importNode(smap->item(i), true, true));
+                            tmap->setNamedItem(importNode(smap->item(i), true, cloningDoc));
                         }
                     }
                 }
@@ -1242,7 +1242,7 @@
              srckid != 0;
              srckid = srckid->getNextSibling())
         {
-            newnode->appendChild(importNode(srckid, true, false));
+            newnode->appendChild(importNode(srckid, true, cloningDoc));
         }
 
     if (newnode->getNodeType() == DOMNode::ENTITY_NODE) {
@@ -1250,7 +1250,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