All pastes #133313 Raw Edit

Something

public text v1 · immutable
#133313 ·published 2006-08-15 20:22 UTC
rendered paste body
unit MainFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, jvsimplexml;

type
  TForm1 = class(TForm)
    ListView1: TListView;

    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  xml : TJvSimpleXml;
  n: integer;
  artist: string;
  title: string;
  album: string;
  li:TListItem;
begin
  ListView1.Columns[0].Width := round(ListView1.Width / 3);
  ListView1.Columns[1].Width := round(ListView1.Width / 3);
  ListView1.Columns[2].Width := round(ListView1.Width / 3) -5;
  ListView1.Columns[0].Caption := 'Artist';
  ListView1.Columns[1].Caption := 'Title';
  ListView1.Columns[2].Caption := 'Album';

  xml:= TJvSimpleXml.Create(nil);
  xml.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'daedalus.xml');

  for n := 0 to xml.Root.Items.count -1 do begin
    with xml.Root.Items.Item[n].Items do begin
      artist := Value('artist');
      title := Value('title');
      album := Value('album');
    end;

    li := ListView1.Items.Add;
    li.Caption := artist;
    li.SubItems.Add(title);
    li.SubItems.Add(album);
 end;
end;

end.