乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      delphi創(chuàng)建和讀取xml(xml簡單操作舉例)

       老魏的書架 2013-02-16

      delphi創(chuàng)建和讀取xml(xml簡單操作舉例)

      有關(guān)許多接口,會需要通過xml進行數(shù)據(jù)交換,弄個例子,方便參考

      unit Unit1;

      interface

      uses
        Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
        Dialogs,XMLDoc,XMLIntf, StdCtrls;

      type
        TForm1 = class(TForm)
          Button1: TButton;
          Button2: TButton;
          Memo1: TMemo;
          procedure Button1Click(Sender: TObject);
          procedure Button2Click(Sender: TObject);
        private
          { Private declarations }
        public
          { Public declarations }
        end;

      var
        Form1: TForm1;

      implementation

      {$R *.dfm}

      procedure TForm1.Button1Click(Sender: TObject);
      var
      Xml: TXMLDocument;
      Rootnode,node : IXMLNode;
      begin
      Xml := TXMLDocument.Create(nil);
      // Xml.LoadFromFile('aaa.xml');
      try
      //加入版本信息 ‘<?xml version="1.0" encoding="GB2312" ?> ’
      Xml.Active := True;
      Xml.Version := '1.0';
      Xml.Encoding :='GB2312';

      Rootnode := Xml.CreateNode('CIF_INFO');
      Xml.DocumentElement := Rootnode;
      node := Xml.CreateNode('TXNCODE');
      Rootnode.ChildNodes.Add(node);
      node.Text := '420001';
      node := Xml.CreateNode('RESPCODE');
      Rootnode.ChildNodes.Add(node);
      node.Text := '0000';
      node := Xml.CreateNode('CIFID');
      Rootnode.ChildNodes.Add(node);
      node.Text := '0030209728';
      node := Xml.CreateNode('RESCODE');
      Rootnode.ChildNodes.Add(node);
      node.Text := '0000';
      node := Xml.CreateNode('RESMSG');
      Rootnode.ChildNodes.Add(node);
      node.Text := '';

      Xml.SaveToFile('aaa.xml');
      xml.Active := False;
      showmessage('創(chuàng)建成功!');
      finally
      Xml.Free;
      end;
      end;

      procedure TForm1.Button2Click(Sender: TObject);
      var
      Xml: TXMLDocument;
      Rootnode,node : IXMLNode;
      nodelist:IXMLNodeList;
      b,c,str :string;
      i:Integer;
      begin
      Xml := TXMLDocument.Create(Application);


      try
      Xml.LoadFromFile('aaa.xml');
      Xml.Active := True;

      Rootnode := Xml.DocumentElement;
      nodeList :=Rootnode.ChildNodes;
       for i:=0 to nodelist.Count-1 do
          begin
            if  Rootnode.ChildNodes[i].NodeValue = null then
               begin
                 c:='空';
               end
               else
               begin
                 c:= Rootnode.ChildNodes[i].NodeValue;
               end;
            str:=str+c+#13#10;
          end;
      //b := Rootnode.ChildNodes[ 'CIFID'].NodeValue;
      Memo1.Lines.Add(str);
      xml.Active := False;
      finally
      Xml.Free;
      end;
      end;
      end.

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多