Hi Affe,
documents can only contain nodes created by the same document; so you first need to first import the nodes in the target document

DOMNode* n=dom_root2->getFirstChild();
while(n)
{
 dom_root1->appendChild(dom_root1->importNode(n));
 n = n->getNextSibling();
}

Alberto

[EMAIL PROTECTED] wrote:
hi

I am trying to append a DOMDocument to another DOMDocument:


DOMDocument *dom_root1 = parser1->getDocument();
DOMDocument *dom_root2 = parser2->getDocument();
                
dom_root1->appendChild(dom_root2);


but I get the error:
A node is used in a different document than the one that created it

greatings
  Affe


Reply via email to