procedure TForm1.Button1Click(Sender: TObject);
var
StartTime, EndTime: TDateTime;
XMLSource, IDList: TStringList;
i, FoundCount: Integer;
FilePath, FileName: String;
begin
XMLSource:=TStringList.Create;
IDList:=TStringList.Create;
IDList.Text:=Memo1.Text;
StartTime:=Time;
try
for i:=0 to IDList.Count-1 do
begin
FileName:=IDList.Strings[i];
FilePath:=ExtractFilePath(ParamStr(0))+'
XML\'+Copy(FileName,Length(FileName)-1,Length(FileName))+'\'+FileName+'.xml';
if FileExists(FilePath) then
begin
XMLSource.LoadFromFile(FilePath);
if Pos('MyString',XMLSource.Text)>0 then
Inc(FoundCount);
XMLSource.Clear;
end;
end;
finally
IDList.Free;
XMLSource.Free;
end;
EndTime:=Time;
ShowMessage(IntToStr(FoundCount)+' Time: '+TimeToStr(EndTime-StartTime));
end;