Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Общие вопросы > it doesnt refresh the listview !!!


Автор: muratboy31 4.3.2010, 12:36
i download xml file from internet and list nodes to listview but it doesnt refresh the list if i download from anoter link !!! why is that ?


Код

procedure TForm1.GoClick(Sender: TObject);
var
  ADPLocalFile : TFileName;
  StartItemNode : IXMLNode;
  ANode : IXMLNode;
  STitle, sDesc, sLink, ADPXMLBLOG : widestring;
  Num:integer;
begin
  ADPXMLBLOG := Combobox1.Text;
  if ADPXMLBLOG <> '' then
 begin
  ADPLocalFile := 'rss.xml';
  try
    if not DownloadURLFile(ADPXMLBLOG, ADPLocalFile)  then
    begin
      Raise Exception.CreateFmt('Wrong Link or No Connection ! ',[]);
      Exit;
    end;
     if not FileExists(ADPLocalFile) then
    begin
      raise exception.Create('No Headers  ! ');
      Exit;
    end;
    lv.Clear;

    XMLDoc.FileName := ADPLocalFile;
    XMLDoc.Active:=True;

    StartItemNode:=XMLDoc.DocumentElement.ChildNodes.First.ChildNodes.FindNode('item');
    ANode := StartItemNode;
    repeat
      STitle := ANode.ChildNodes['title'].Text;
      sLink := ANode.ChildNodes['link'].Text;
      sDesc := ANode.ChildNodes['description'].Text;
      with LV.Items.Add do
      begin
        Caption := STitle;
        SubItems.Add(sLink);
        SubItems.Add(sDesc)
      end;
       ANode := ANode.NextSibling;
    until ANode = nil;
  finally
        DeleteFile(ADPLocalFile);
  end;
 end;
end;

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)