grafting DOM doc [as a fragment] into another DOM doc [node] 
Author Message
 grafting DOM doc [as a fragment] into another DOM doc [node]

Does anyone know if someone has written some code which will graft
another DOM document [as a fragment] into another DOM node?

ie.

$nodeFoo->importChildFrag($domDoc);
OR
$nodeFoo->importChildFrag($nodeBar);
where $nodeBar is from a different document object to $nodeFoo.

This would be useful when working with DOM XML applications that want to
import XML flat files into the main application XML [source] tree.

I just thought I'd check before re-inventing the wheel. If there are no
takers, I'll go ahead and write "importChildFrag()" myself.



Sun, 06 Nov 2005 14:50:03 GMT  
 grafting DOM doc [as a fragment] into another DOM doc [node]
hmmmmm.....

     function ImportChildFrag($objDoc,$ndStub,$ndNew) {
         $ndTmp = $objDoc->create_element("tmp");
         $ndTmp = $ndStub->append_child($ndTmp);
         $ndTmp->replace_node($ndNew);
         return $ndNew;
     }

yes, $ndNew is from a foreign document.
$ndStub is an element belonging to $objDoc DOM document.

* had to use the "replace" method because none of the "append" methods
worked.
* this behaviour is probably not intended
* this behaviour will probably be changed in subsequent releases

This was done using PHP 4.3.0



Mon, 07 Nov 2005 20:47:12 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. FIXED: Accessing DOM nodes in Python

2. Accessing DOM nodes in Python

3. XML dom node comparaison

4. xml.dom.minidom.parse() splitting text nodes?-THANKS

5. xml.dom.minidom.parse() splitting text nodes?

6. Vds doc V5.3 ( To sell doc v5.3 )

7. Logo1.doc and Math1.doc in cyberspace

8. PROPOSAL: [].__doc__, "".__doc__, ...

9. doc string substition and overloading __doc__

10. Patches for tcl8.0/doc/* and tk8.0/doc/*

11. tcl8.0b1/doc and tk8.0b1/doc patches

12. [Doc-SIG] [development doc updates]

 

 
Powered by phpBB® Forum Software