title: Moving a node from one XML document to another using SimpleXML
body: <p>I realize that my request is not possible using just SimpleXML -- that much I did figure out. Here is what I tried:</p>
  
  <pre><code>$newXML = simplexml_load_file($filePath); 
  $domNewXML = dom_import_simplexml($newXML);
  $domItem = dom_import_simplexml($items[$itemQty]);  &lt;-- item I want to move
  $domNewItem = $domItem-&gt;cloneNode(true);
  $newNode = $domNewXML-&gt;importNode($domNewItem, true);
  $domNewXML-&gt;getElementsByTagName('list')-&gt;item(0)-&gt;appendChild($newNode);
  </code></pre>
  
  <p>I realize the code errors out on line 5, because importNode is a function of the dom document, not the dom element, but how can I get the dom document to perform this step?</p>
  
  <p>Am I going about this the right way?</p>
  
  <p>In the grand scheme of things I have an XML file with at least 10 nodes, every day a CRON job checks to see if there are more than 10 nodes and if so, it's supposed to move the node from the current file into an archive file. I figured I would "move" the node by copying it to the archive file and deleting it from the original file.</p>
  
  <p>Thanks for any help!</p>