delphi 一个关于xml文件导入数据库的问题
2015-07-18 16:08
459 查看
function LoadXml(shortPath:string;var xmlobj: IXMLDOMDocument):boolean; var tmpXml:IXMLDOMDOCUMENT; begin shortPath:=localPath+shortPath; if not FileExists(shortPath) then begin LoadXml:=false; exit; end; tmpxml := CreateOLEObject('Microsoft.XmlDom') as IXMLDOMDocument; tmpxml.async := false; tmpxml.load(shortPath); if tmpxml.parseError.errorCode <> 0 then begin LoadXml:=false; Exit; end; xmlobj:=tmpxml; tmpxml:=nil; Loadxml:=true; end; procedure InitNetInfo(var theNet:netInfoType); var objxml:IxmlDomdocument; Node1:IxmlDomNode; begin if not Loadxml(iniFile,objXml) then exit; Node1:=objXml.selectSingleNode('//DefaultIP'); if Node1<>nil then theNet.Csdn_IP:=Node1.text; Node1:=objXml.selectSingleNode('//DefaultPath'); if Node1<>nil then theNet.Csdn_Path:=Node1.text; Node1:=objXml.selectSingleNode('//UseProxy'); if Node1<>nil then theNet.flg_UseProxy:=StrtoBool(Node1.text); Node1:=objXml.selectSingleNode('//ProxyIP'); if Node1<>nil then theNet.prx_IP:=Node1.text; Node1:=objXml.selectSingleNode('//ProxyPort'); if Node1<>nil then theNet.prx_Port:=Node1.text; Node1:=objXml.selectSingleNode('//ProxyUser'); if Node1<>nil then theNet.prx_User:=Node1.text; Node1:=objXml.selectSingleNode('//ProxyPass'); if Node1<>nil then theNet.prx_Pass:=Node1.text; //其他信息 Node1:=objXml.selectSingleNode('//HeadSize'); if Node1<>nil then HeadSize:=strtoint(Node1.text); Node1:=objXml.selectSingleNode('//TopicSize'); if Node1<>nil then TopicSize:=strtoint(Node1.text); objxml:=nil; Node1:=nil; end;
相关文章推荐
- Delphi 自带了 Base64 编解码的单元
- Delphi 自带了 Base64 编解码的单元
- DevExpress VCL for Delphi 各版本收集下载(最新支持Delphi XE 7)
- delphi 异形窗体可半透明
- delphi 异形窗体可半透明
- 如何在程序中执行动态生成的Delphi代码
- 如何在程序中执行动态生成的Delphi代码
- delphi 获取程序版本及时间
- delphi 获取程序版本及时间
- delphi PChar与String互转
- delphi PChar与String互转
- Base64编码/解码Delphi源码
- Base64编码/解码Delphi源码
- DELPHI 把数据库中的数据转换成XML格式
- DELPHI 把数据库中的数据转换成XML格式
- delphi RichEdit的内容保存为图片
- delphi RichEdit的内容保存为图片
- 在TXT文件中查找指定字符串并显示指定字符串所在行的内容
- Delphi 遍历所有目录和子目录下的文件名(可按后缀名遍历)
- Delphi代码记事本