Ben Griffin wrote:
Is this the best way to duplicate a DOMDocument?

DOMNode* n = original->cloneNode(true);
DOMDocument *copy = static_cast<DOMDocument *>(n);
Yes.


Is there a way of doing this that avoids using a static_cast?
No, there isn't. In C++, cloneNode() could use a co-variant return type, but the DOM interfaces are designed to be implementable by a wide range of languages.

Dave

Reply via email to