#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Help converting ClientDataSet to dfXMLUTF8


    It's simple really - I want to open this CDS file(Oops - guess I don't have enough posts to link to content) and save it as an XML file. Here's my code - It's giving an error of "Declaration expected but end of file found"; Thanks for any help!

    Code:
    unit Script3;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, DBClient;
    
    type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
      CDS: TClientDataSet;
    
    implementation
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      CDS := TClientDataSet.Create(nil);
      try
        CDS.LoadFromFile('C:\Master.cds');
        CDS.SaveToFile('C:\Master.XML', dfXMLUTF8);
      finally
        CDS.Free;
      end;
    end;
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Augsburg Germany
    Posts
    12
    Rep Power
    0
    just a missing end. at the end of the unit ...

    Originally Posted by skibulk
    It's simple really - I want to open this CDS file(Oops - guess I don't have enough posts to link to content) and save it as an XML file. Here's my code - It's giving an error of "Declaration expected but end of file found"; Thanks for any help!

    Code:
    unit Script3;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, DBClient;
    
    type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
      CDS: TClientDataSet;
    
    implementation
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      CDS := TClientDataSet.Create(nil);
      try
        CDS.LoadFromFile('C:\Master.cds');
        CDS.SaveToFile('C:\Master.XML', dfXMLUTF8);
      finally
        CDS.Free;
      end;
    end;
    end.

IMN logo majestic logo threadwatch logo seochat tools logo