You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Ben Griffin <be...@redsnapper.net> on 2009/02/27 14:28:38 UTC
Duplicating a DOMDocument?
Is this the best way to duplicate a DOMDocument?
DOMNode* n = original->cloneNode(true);
DOMDocument *copy = static_cast<DOMDocument *>(n);
Is there a way of doing this that avoids using a static_cast?
Re: Duplicating a DOMDocument?
Posted by David Bertoni <db...@apache.org>.
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