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;