procedure TFmain.Bstandart_speichernClick(Sender: TObject);
var
index: integer;
newBild, newThema: IXMLDOMNode;
newSub: IXMLDOMNode;
begin
xmlDoc := CoDOMDocument40.Create;
xmlDoc.setProperty('NewParser', true);
if not FileExists(fAppPath + DATABASE_FNAME) then begin
xmlDoc.loadXML('<?
xml version="1.0" encoding="ISO-8859-1"?><bilderdatenbank></bilderdatenbank>');
xmldoc.save(fAppPath + DATABASE_FNAME);
end else
xmlDoc.load(fAppPath + DATABASE_FNAME);
if xmlDoc.parseError.errorCode <> 0 then begin
MessageDlg('Die
XML-Datei ist nicht korrekt!' + #13#10
+'Der MovieOrganizer wird nun beendet.',
mtError, [mbOK], 0);
Application.Terminate;
if xmlDoc.documentElement.nodeName <> 'bilderdatenbank' then
Application.Terminate;
end;
newThema := xmlDoc.createElement('Thema');
xmlDoc.documentElement.appendChild(newThema);
for index := 0 to ListBox1.Items.Count -1 do
begin
newBild := xmlDoc.createElement('Bild');
newSub := xmlDoc.createElement('name');
newSub.text := ListBox1.Items.Strings[Index];
newBild.appendChild(newSub);
newSub := xmlDoc.createElement('text');
newSub.text := atext;
newBild.appendChild(newSub);
newThema.appendChild(newBild);
end;
xmlDoc.documentElement.appendChild(newThema);
xmlDoc.save(fAppPath + DATABASE_FNAME);
end;