问题
I asked how to copy a sub node structure from one XML file to another XML file (merge the two XML files) in this question:
How to copy a sub node structure from one XML file to another XML file (merge two XML files)?
The useful and detailed answers from Remy Lebeau and Olivier work fine when I do not set the DOMVendor
.
However, when I set the DOMVendor
to 'Omni XML'
, I get an EXMLException
error when the cloned node is added to the ChildNodes
list:
NewChild was created from a different document than the one that created this node.
The exception is raised in unit Xml.Internal.OmniXML
in
function OmniTXMLNode.appendChild(const NewChild: OmniIXMLNode): OmniIXMLNode;
var
Node: OmniIXMLNode;
SPrefix: string;
URIIDCh, URIIDPa: TDicId;
begin
// NewChild should be created from the same document than the one that created this node
if (Self.OwnerDocument <> nil) and (NewChild.OwnerDocument <> nil) and (NewChild.OwnerDocument <> Self.OwnerDocument) then
raise EXMLException.CreateParseError(WRONG_DOCUMENT_ERR, MSG_E_WRONG_DOCUMENT, []);
Target platform is 64-bit Windows. I would like to use 'Omni XML'
because it seems to be much faster than 'MSXML'
.
How to solve this problem?
来源:https://stackoverflow.com/questions/63160830/how-to-copy-a-sub-node-structure-from-one-xml-file-to-another-xml-file-merge-tw