不行的,微软由一个XML的控件,我忘了名字

解决方案 »

  1.   

    导入微软的xmldom2.0这个东西。然后就可以//装入本地的xml文件
    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;
      

  2.   

    adoquery组件直接能支持从xml导入,跟使用数据库一样,但一齐更新进数据库就没试过,应该可以的
      

  3.   

    当然前提是那个xml文件一定要为adoquery组件导出的xml格式
      

  4.   

    是否是固定格式的?
    如果是固定格式的话,用TOOLS菜单下的XML MAPPER生成转换文件(*.XTR),然后用DATA ACCESS下的ClientDataSet控件生成数据集就可以了。 有了数据集,随便如何操作了。 Borland\Delphi6\Demos\Internet\下有XML转化为数据集的DEMO。
      

  5.   

    回复xzhongjin(无聊的很)    可否给我你的那份例子程序;邮件地址 [email protected]
      谢谢
      

  6.   

    var
      sourcefile,destfile:TextFile;
      tablename,sselect,sourcerow:string;
    begin
      adoquery.SaveToFile(ExtractFileDir(Application.ExeName)+'\temp.dat',pfXML);
      AssignFile(sourcefile,ExtractFileDir(Application.ExeName)+'\temp.dat');
      AssignFile(destfile,ExtractFileDir(Application.ExeName)+'\'+tablename);
      Reset(sourcefile);
      Rewrite(destfile);
      try
        while true do
        begin
          Readln(sourcefile,sourcerow);
          if trim(sourcerow)='</xml>' then
          begin
            Writeln(destfile,sourcerow);
            break;
          end;
          if trim(sourcerow)='<rs:data>' then
          begin
            Writeln(destfile,sourcerow);
            Writeln(destfile,'<rs:insert>');
            Continue;
          end;
          if trim(sourcerow)='</rs:data>' then
          begin
            Writeln(destfile,'</rs:insert>');
            Writeln(destfile,sourcerow);
            Continue;
          end;
          Writeln(destfile,sourcerow);
        end;
      finally
        CloseFile(sourcefile);
        CloseFile(destfile);
      end;
    end;
    我从程序中挖来的,自己改改
      

  7.   

    我也要 [email protected]
    最近我也在學習xml