unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, xmldom, XMLIntf, msxmldom, XMLDoc, ComCtrls, StdCtrls, ImgList; type TForm1 = class(TForm) Button1: TButton; ListView1: TListView; XMLDocument1: TXMLDocument; ImageClass: TImageList; ImageRace: TImageList; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Edit1: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } procedure DownloadOnlinePlayers; end; var Form1: TForm1; implementation {$R *.dfm} { TForm1 } procedure TForm1.DownloadOnlinePlayers; var StartItemNode : IXMLNode; ANode : IXMLNode; sName, sLevel, sRace, sClass, sZone, sMap, sHonor: WideString; begin ListView1.Clear; try XMLDocument1.FileName := Edit1.Text; XMLDocument1.Active:=True; try Label1.Caption := 'Název Serveru: '+XMLDocument1.DocumentElement.ChildNodes.FindNode('name').Text; Label2.Caption := 'Vlastník Serveru: '+XMLDocument1.DocumentElement.ChildNodes.FindNode('owner').Text; Label3.Caption := 'Maximální počet hráčů: '+XMLDocument1.DocumentElement.ChildNodes.FindNode('maxplayers').Text; Label4.Caption := XMLDocument1.DocumentElement.ChildNodes['players'].ChildNodes.FindNode('playerscount').Text; except end; StartItemNode := XMLDocument1.DocumentElement.ChildNodes['players'].ChildNodes.FindNode('player'); ANode := StartItemNode; repeat sName := ANode.ChildNodes['name'].Text; sLevel := ANode.ChildNodes['level'].Text; sRace := ANode.ChildNodes['race'].Text; sClass := ANode.ChildNodes['class'].Text; sZone := ANode.ChildNodes['zone'].Text; sMap := ANode.ChildNodes['map'].Text; sHonor := ANode.ChildNodes['honor'].Text; with ListView1.Items.Add do begin Caption := sName; SubItems.Add(sLevel); SubItems.Add(sZone); SubItems.Add(sMap); SubItems.Add(sHonor); ImageIndex := StrToInt(sClass)-1; StateIndex := StrToInt(sRace)-1; end; ANode := ANode.NextSibling; until ANode = nil; except On E : Exception do begin ShowMessage('Nepodařilo se načíst online hráče!'); end; end; XMLDocument1.Active := False; end; procedure TForm1.Button1Click(Sender: TObject); begin DownloadOnlinePlayers; end; end.