procedure TForm1.Button1Click(Sender: TObject);
var
LoopNodes : IDOMNodeList;
i: Integer;
begin
XMLDoc.FileName := '.\G1839366.XML';
XMLDoc.Active := True;
try
LoopNodes:= XMLDoc.DOMDocument.getElementsByTagName( 'DEVICE' );
ListView1.Items.BeginUpdate;
try
for i:= 0 to LoopNodes.length -1 do
with ListView1.Items.add do begin
Caption:= LoopNodes[i].attributes.getNamedItem('Name').nodeValue;
SubItems.Add( LoopNodes[i].attributes.getNamedItem('SN').nodeValue );
end;
finally
ListView1.Items.EndUpdate;
end;
finally
XMLDoc.Active := False;
end;
end;
|