TXMLDocument domvendor = ADOM XML v4
var
root: IXMLnode;
lei: IXMLNode;
info: IXMLNode;
i: integer;
strxml:string;
xmldoc:TXMLDocument;
begin
cbbCountry.Items.Clear;
try
strxml := ‘<?xml version="1.0" encoding="GB2312"?>‘;
strxml := strxml + (httprio1 as DataCenterServicesSoap).GetCZD(xz);
xmldoc := TXMLDocument.create(nil);
xmldoc.LoadFromXML(strxml);
root := xmldoc.DocumentElement;
lei := root.ChildNodes.First;
while lei <> nil do
begin
if lei.NodeName = ‘Item‘ then
begin
info := lei.ChildNodes.First;
clientdatasetcountry.append;
while info <> nil do
begin
if info.NodeName = ‘unitId‘ then
begin
clientdatasetcountry.fieldbyname(‘unitId‘).value := info.text;
end
else if info.NodeName = ‘name‘ then
begin
clientdatasetcountry.fieldbyname(‘name‘).value := info.text;
end;
info := info.NextSibling;
end;
end;
clientdatasetcountry.post;
lei := lei.NextSibling;
end;
finally
xmldoc.free;
end;
cbbcountry.items.Clear;
clientdatasetcountry.first;
while not clientdatasetcountry.eof do
begin
if trim(clientdatasetcountry.FieldByName(‘name‘).asstring) <> ‘‘ then
cbbcountry.items.add( clientdatasetcountry.FieldByName(‘name‘).asstring);
clientdatasetcountry.next;
end;
本文出自 “一切有为法,如梦幻泡影” 博客,请务必保留此出处http://kaixinbuliao.blog.51cto.com/2567365/1528423
原文地址:http://kaixinbuliao.blog.51cto.com/2567365/1528423