type
{ TUnsupportedDesktopOpt }
TUnsupportedDesktopOpt = Class(TAbstractDesktopOpt)
private
FRetainXMLData:TDOMDocument; {This or some other appropriate structure}
public
destructor Destroy; override;
procedure Load(Path: String); override;
procedure Save(Path: String); override;
end;
//[...]
procedure TUnsupportedDesktopOpt.Load(Path: String);
var
lPnode, lChldNode: TDOMNode;
i: Integer;
begin
FreeAndNil(FRetainXMLData);
FRetainXMLData:=TDOMDocument.Create;
lPnode := FXMLCfg.FindNode(Path,false);
for i := 0 to lPnode.ChildNodes.Count-1 do
begin
lChldNode := lPnode.ChildNodes[i].CloneNode(true);
[/i] FRetainXMLData.ImportNode(lChldNode,true); // to set the owner of the cloned node to the Document
FRetainXMLData.AppendChild(lChldNode); // to actually append the node
end;
end;
procedure TUnsupportedDesktopOpt.Save(Path: String);
var
i: Integer;
lChldNode: TDOMNode;
begin
if assigned(FRetainXMLData) and assigned(FXMLCfg.FindNode(path,false)) then
for i := 0 to FRetainXMLData.ChildNodes.Count-1 do
begin
lChldNode := FRetainXMLData.ChildNodes.CloneNode(true); // Make a copy of the node
FXMLCfg.Document.ImportNode(lChldNode,true); // Import the copied nodes to the Configuration-document
FXMLCfg.FindNode(path,false).AppendChild(lChldNode); // append the nodes at the right place
end;
end;