A node must always be owned by a document, and a node from one document may not be appended to another.

There is, however, an "import(node)" method on Document that may be used to copy a node from one document into another.

I hope that helps.

Erik

On 10-Aug-08, at 8:26, "Daniel Burrell" <[EMAIL PROTECTED]> wrote:

Suppose you have 2 documents.
docONE
docTWO

If I create a DOMElement with docOne

DOMElement *myChild = docOne- >createElement(XMLString::transcode("temp"));

and I then try to attatch the new myChild element to docTWO, like this

docTWO->getDocumentElement()->appendChild(myChild);

I get an exception raised.

Why is this? I see it is possible to get the owner document of a node.
But I can't see the matching set method.

Also, is there no way to create an element without attaching it to a
document?
sort of

DOMElement *myChild = new DOMElement(XMLString::transcode("temp"));

Thanks

Reply via email to