procedure XMLmergeBasefileWithAnotherFile(aBaseXMLfile:
string; aAnotherXMLfile:
string; aTargetFile:
string);
var
XmldocBase : DOMDocument;
RootBase : IXMLDOMNode;
NodeBase : IXMLDOMNode;
ListBase : IXMLDOMNodeList;
XmldocAnother : DOMDocument;
RootAnother : IXMLDOMNode;
NodeAnother : IXMLDOMNode;
ListAnother : IXMLDOMNodeList;
i, j : integer;
begin
// -- Base file laden --
XmlDocBase := CoDOMDocument.Create;
if not xmlDocBase.load(aBaseXMLfile)
then exit;
RootBase := XmlDocBase.documentElement;
ListBase := RootBase.childNodes;
// -- Another file laden --
XmldocAnother := CoDOMDocument.Create;
if not XmldocAnother.load(aAnotherXMLfile)
then exit;
RootAnother := XmlDocBase.documentElement;
ListAnother := RootAnother.childNodes;
NodeBase := RootBase.firstChild;
NodeAnother := RootAnother.firstChild;
while NodeAnother.NextSibling <>
nil do
begin
NodeBase.appendChild(NodeAnother);
NodeAnother := NodeAnother.NextSibling;
end;
// -- gemergte Base XML speichern --
XmldocBase.save(aTargetFile);
end;