title: Merge two XML files with Delphi XE10
body: <p>I try to merge two XML files (created with MSword) with the code bellow but although it runs without any error, i receive an error message when i try to open the merged file. Actually the merged file contains the first's file content plus only the first line of the second (the line " &lt; ?xml version="1.0" encoding="UTF-8" standalone="yes" ? > "). No merged contents!</p>
  
  <p>// button select the first file then button2 selects the second and merges them</p>
  
  <pre><code>uses XML.xmlDoc,XML.XMLintf;
  
  var XMLDoc1, XMLDoc2 : TXMLDocument;
  
  procedure TForm30.Button1Click(Sender: TObject);
  begin
      if OpenDialog1.Execute then begin
          XMLDoc1 := TXMLDocument.Create(self);
          XMLDoc1.Active := True;
          XMLDoc1.LoadFromFile(OpenDialog1.filename);
      end;
  end;
  
  procedure TForm30.Button2Click(Sender: TObject);
  var ANode: IXMLNode;
  begin
      if OpenDialog1.Execute then begin
          XMLDoc2 := TXMLDocument.Create(self);
          xmlDoc2.Active:= True;
          XMLDoc2.LoadFromFile(OpenDialog1.filename);
          ANode:= XMLDoc2.ChildNodes[0].CloneNode(True);
          xmlDoc1.ChildNodes.add(ANode);
          xmlDoc2.Active:= False;
          xmlDoc1.SaveToFile('c:\' + 'Merge.xml');
          XMLDoc1.free;
          XMLDoc2.free;
          aNode.free;
      end;
  end;
  </code></pre>
  
  <p>What i'm doing wrong, please ?
  thanks in advance.</p>