[Lazarus] Problem reading an XML file

Sergei Gorelkin sergei_gorelkin at mail.ru
Fri Jul 17 17:04:16 CEST 2009


John Meyer wrote:
> I'm trying to retrieve an XML file from a web site but I'm not able to
> do it through this code.  Maybe I'm being a little too VB-ish, but
> here's my code:
> 
Reading xml files directly from http isn't supported yet. You have to 
retrieve the data from network using some other means. Once you have the 
data in a local file or in a stream, use ReadXMLFile to parse it.

Regards,
Sergei

> procedure TForm1.btnRetrieveFriendsClick(Sender: TObject);
> var
>    TwitterDoc: TXMLDocument;
>    Child: TDOMNode;
>    j: Integer;
>    strURL: AnsiString;
>    ID: TDOMNode;
>    UserName: TDOMNode;
> begin
>      strURL := 'http://twitter.com/statuses/friends/' + edUserName.Text
> + '.xml';
>      ReadXMLFile(TwitterDoc,strURL);
>      Child := TwitterDoc.DocumentElement.FirstChild;
>      while Assigned(Child) do
>      begin
>      UserName := Child.FindNode('name');
>      ID := Child.FindNode('id');
>      lstFriends.Items.Add(UserName.NodeValue + '(' + ID.NodeValue + ')');
>      Child := Child.NextSibling;
> 
>      end;
> 
> end;
> 





More information about the Lazarus mailing list