功能: 根据省份更新地市信息
-------------------------------------------------------------------------------}
procedure TForm.GetCityInfo;
var
iXMLAreaFile : IXMLDocument;
sFileName,aProvince,sProvince,sCity : string;
nCol,nNum,nCityCount,nprovinceCount : Integer;
begin
iXMLAreaFile := TXMLDocument.create(nil);
sFileName := getexepath + 'Province.xml';
iXMLAreaFile.FileName := sFileName;
iXMLAreaFile.active := True;
sProvince := cbbprovince.Text;
if sProvince = '全部' then
begin
cbbcity.Items.Clear;
cbbcity.Items.Add('全部');
cbbcity.ItemIndex := ;
end
else
begin
cbbcity.Items.Clear;
cbbcity.Items.Add('全部');
cbbcity.ItemIndex := ;
nprovinceCount := iXMLAreaFile.DocumentElement.childnodes.Count;
for nNum := to nprovinceCount- do
begin
//获取province节点内容
aProvince := iXMLAreaFile.DocumentElement.ChildNodes[nNum].
AttributeNodes[].nodevalue;
if aProvince = sProvince then
begin
ncityCount := iXMLAreaFile.DocumentElement.childnodes[nNum].childnodes.Count;
//获取市级节点内容
for nCol := to ncitycount- do
begin
sCity := iXMLAreaFile.DocumentElement.ChildNodes[nNum].
childnodes[nCol].AttributeNodes[].nodevalue;
cbbCity.Items.Add(sCity);
end;
end;
end;
end;
end;