To import an XMLDOMNode from one xml to an other one, you have to use
importNode
from the
IXMLDOMDocument3
interface.
you cannot add a node from an xml document inside an other document without
importNode
.
For example:
MSXML2::IXMLDOMDocument3Ptr xml;
xml.CreateInstance(__uuidof(DOMDocument60));
MSXML2::IXMLDOMElementPtr elt = xml->createElement("root");
xml->appendChild(elt);
MSXML2::IXMLDOMDocument3Ptr subxml;
subxml.CreateInstance(__uuidof(DOMDocument60));
subxml->loadXML(fromString);
MSXML2::IXMLDOMNodePtr node = xml->importNode(subxml->GetdocumentElement(),VARIANT_TRUE);
elt->appendChild(node);
I did not check with subxml nodes that contains namespace.
DOMDocument60 is available when importing XML v6
#import <msxml6.dll>
#include <msxml6.h>
#include <msxml.h>