Writing a copy constructor always does the “Right Thing” for each member variable. Without seeing the API documents for your DOMImplementation , etc., It’s hard to say that there will be a “Right Thing”. Perhaps they have a copy constructor or a function to create a deep copy. You may not need a deep copy semantically (e.g. for DOMImplementation ).
On the bottom line, it's hard to say without seeing the API docs that you obviously get around ...
Edit: So you are using Xerces-C. You did not tell us that before ...
Edit 2: Let's see, then ...
The Xerces-C API does not really provide any “easy” ways to copy a document object from what I see. AFAICT, you will need to create a completely new document ( impl->createDocument() ), and then manually copy all the attributes and child nodes.
It is so inconvenient that I would ask the question "why do I want to copy my XMLDocument object, one way or another? Does it even make sense at the semantic level?". (Personal experience: if something gets ugly when working with a well-used API, most likely you are doing something wrong, because otherwise it will be an easy way. XML is not my strong streak, so I'm not in my depth here .)
source share