this slowpoke moves

RSS Reader

uses MSXML

//

procedure TForm1.Button1Click(Sender: TObject);
var
 CityID: string;
 CoDoc: CoDOMDocument;
 XMLD: DOMDocument;
 r: IXMLDOMElement;
 FNode: IXMLDOMNode;
 i,y: integer;
begin
 XMLD:=CoDoc.Create ;
 XMLD.async:=false;
 URL:=ComboBox1.Text;
 XMLD.load(URL);
 memo1.Clear;
 r:=XMLD.documentElement;
 FNode:= r.SelectSingleNode('//rss');
 if FNode.attributes.getNamedItem('version').text<>'2.0'
 then
  begin
   Memo1.Lines.Add('The RSS version does not match 2.0');
   Exit;
  end;
 FNode:= FNode.SelectSingleNode('//channel');
 Memo1.Lines.Add('Info: ');
 Memo1.Lines.Add('Owner - ' + FNode.selectSingleNode('//title').text);
 Memo1.Lines.Add('Copyright : - ' + FNode.selectSingleNode('//copyright').text);
 Memo1.Lines.Add('Date / Time : - '+FNode.selectSingleNode('//lastBuildDate').text);
 Memo1.Lines.Add('');
 Memo1.Lines.Add('News: ');
 for i:=0 to FNode.selectNodes('//item').length-1 do
  begin
   Memo1.Lines.Add('Contents : - ' + FNode.selectNodes('//item').item[i].childNodes.item[0].text);
   Memo1.Lines.Add('Link : - ' + FNode.selectNodes('//item').item[i].childNodes.item[1].text);
   Memo1.Lines.Add('');
  end;
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate