Given the XML snippet below, how can I get the value of the XML attribute TEXT?
<POPULARITY URL="example.com" SOURCE="panel" TEXT="27503270" />
Negative...
MY CODES...:
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
if kontrol=0 then
begin
XMLDocument1.Active:=false;
XMLDocument1.FileName:='http://data.alexa.com/data?cli=10&dat=snbamz&url=aliatabak.com';
XMLDocument1.Active:=true;
end;
i:=1;
baslangic:=XMLDocument1.DocumentElement.ChildNodes.FindNode('SD');
repeat
isim:=baslangic.ChildNodes.Nodes['??????'].Text;
edit1.Text:=isim;
i:=i+1;
baslangic:=baslangic.NextSibling;
Until baslangic=nil;
end;
Use the IXMLNode.Attributes property:
isim := VarToStr(baslangic.Attributes['TEXT']);
Or the IXMLNode.AttributeNodes property:
Isim := baslangic.AttributeNodes.Nodes['TEXT'].Text;
Or:
Attr := baslangic.AttributeNodes.FindNode('TEXT');
If Attr <> nil then
isim := Attr.Text;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With