WRONG_DOCUMENT_ERR: A Node Is Used In A Different Document Than The One That Created It
Earlier today, I posted about transferring XML nodes from one ColdFusion XML document object to another. I briefly mentioned that if you try to do that without first importing the target nodes, ColdFusion will throw the following error:
WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it
It turns out though, this is the same error you would get for trying to add the same node to multiple parents of the same document (something I did accidentally in my code). This error, which made sense for the different documentation use, makes very little sense here (using this wording). Anyway, just thought I would post this finding in case anyone comes across it and is like "But I am only using ONE document?!?!?!?"
Reader Comments
Hey man,
I was getting the exact same error too. But in a very different context.
I used Axis to generate Java proxy class for a web service- all in eclipse.
But when I call one of the service methods through the proxy, i get this error (via Axis).
Can you help?
Raener
@Raener,
Hmm, you've got me! I've never actually touched the Axis files directly -- I've only ever gone through ColdFusion and had them do it behind the scenes (ie. using the ?wsdl style invocation).
I wouldn't even know where to begin debugging something like this. Sorry :(
@Ben
Oh okay, thanks neway mate :)
Spent some hours but did figure it out eventually.
It was due to a mal-formed SOAP reply from the sever, and that too a govt server :P
Raener
@Raener,
Glad you got it sorted out. SOAP, in general, is a bit of a bear to deal with :)
What is the solution to this? I am getting same error.
Hi, I have the same problem, I noticed that a fault SOAP response with a detail node is causing the problem. Could you confirm if you are in the same situation, it could give us a clue to find the solution.
Hi, I found a solution on this page. It worked for me.
https://issues.apache.org/jira/browse/AXIS-2705
@Ben
I'm trying to diagnose a problem I'm having where my site throws this WRONG_DOCUMENT_ERR exception. I tried to reproduce the error you experienced by adding the same node to multiple parents of the same document.
I could not reproduce this error using the code below. Do you think a bug has been fixed or am I doing something wrong in trying to reproduce the error?
@Raener,
Click follow link,mybe answer here.
http://stackoverflow.com/questions/3184268/org-w3c-dom-domexception-wrong-document-err-a-node-is-used-in-a-different-docu.