procedure XMLLoadFile;
// <-- De wird auch bei XMLoadFile gebraucht
begin
XMLDocument := TXMLDocument.Create(frmHaupt);
XMLDocument.NodeIndentStr := '
<2 Leerzeichen>';
XMLDocument.FileName := ExtractFilePath(ParamStr(0))+cXMLFileClients;
if not(FileExists(ExtractFilePath(ParamStr(0))+cXMLFileClients))
then
begin
XMLDocument.LoadFromXML('
<?xml version="1.0"?><'+cXMLRootNodeName+'
></'+cXMLRootNodeName+'
>');
XMLDocument.SaveToFile;
end;
try
XMLDocument.Active := true;
except
ShowMessage('
XML Fehler: Die Datei "'+ExtractFilePath(ParamStr(0))+cXMLFileClients+'
" ist fehlerhaft.');
Halt;
end;
end;
procedure XMLSaveFile(TreeView : TTreeView; XMLNode : IXMLNode; TreeViewParent : TTreeNode);
var
TempNode : IXMLNode;
TempTreeNode : TTreeNode;
begin
if TreeViewParent =
nil then
begin
XMLLoadFile;
XMLSaveFile(TreeView, XMLDocument.DocumentElement, TreeView.TopItem);
XMLDocument.SaveToFile(ExtractFilePath(ParamStr(0))+cXMLFileClients);
XMLDocument.Active := false;
XMLDocument.Free;
exit;
end;
TempTreeNode := TreeViewParent.getFirstChild;
while TempTreeNode <>
nil do
begin
TempNode := XMLNode.AddChild(TempTreeNode.Text);
TempNode.Attributes['
type'] := [..];
XMLSaveFile(TreeView, TempNode, TempTreeNode);
TempTreeNode := TempTreeNode.getNextSibling;
end;
end;