DomDocument.importNode

DomNode * importNode(const(DomNode) * src, bool deep) @nogc nothrow pure @safe

A copy of src owned by this document. Deep: with all the descendants and the template contents; else only the node (and the attributes). It returns null if out of memory. The visit is iterative, so deep trees don't overflow the stack.