A ColdFusion user e-mailed me with a problem; he needed to add an XML DOM into another XML DOM, essentially making the first DOM a child node of the first one. Simple assignments returned the following error:
WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
The problem is that ColdFusion will not allow a DOM to be directly assigned to another DOM. The solution is to simply add the desired nodes and elements one by one using the XMLElemNew() function.