Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 839871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:31:53+00:00 2026-05-15T05:31:53+00:00

Are there any Delphi serialization libraries that are capable of serializing records and arrays

  • 0

Are there any Delphi serialization libraries that are capable of serializing records and arrays of records instead of classes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:31:54+00:00Added an answer on May 15, 2026 at 5:31 am

    @Max you can use the TJvAppXMLFileStorage component from JEDI to serialize an record or an array of records.

    you can use the procedure called WriteBinary to store the data and ReadBinary to read.

    unfortunately there is not much documentation on this component, so here you have an very simple example for store a single record (for an array of records you can easily modify this source code).

    The record structure

    type
      MyRecord= record
          Field1 : Integer;
          Field2 : Double;
          Field3 : String[20];
          Field4 : String[20];
      end;
    

    Save an record

    Procedure SaveMyRecord(Rec : MyRecord);
    var
      MyStore: TJvAppXMLFileStorage;
    begin
      MyStore:= TJvAppXMLFileStorage.Create(nil);
      try
        MyStore.FileName:='C:\temp\record.xml'; 
        //this component supports store multiples objects to the same file, so you need use an identifier for you particular object, in this case i'm use the Dummy name.
        MyStore.WriteBinary('Dummy', @Rec,sizeof(Rec));
        MyStore.Xml.SaveToFile(MyStore.FileName);
      finally
        MyStore.Free;
      end;
    end;
    

    this procedure create an XML file like this, the data is encoded in an hexadecimal format.

    <?xml version="1.0" encoding="iso-8859-1"?>
    <Configuration>
      <Dummy>84030000000000003333333333331F400D737472696E6720746573742031000000000000000D737472696E672074657374203200000000000000000000000000</Dummy>
    </Configuration>
    

    Read the persisted data

    Procedure LoadMyRecord(var Rec : MyRecord);
    var
      MyStore: TJvAppXMLFileStorage;
    begin
      MyStore:= TJvAppXMLFileStorage.Create(nil);
      try
        MyStore.FileName:='C:\temp\record.xml';//point to the same file
        MyStore.Xml.LoadFromFile(MyStore.FileName); //load the file
        MyStore.ReadBinary('Dummy', @Rec,sizeof(Rec));//use the Dummy identifier and pass the record as an pointer
      finally
        MyStore.Free;
      end;
    end;
    

    Check this full project (tested in Delphi 7)

    program ProjectPersistRecord;
    
    {$APPTYPE CONSOLE}
    
    uses
      SysUtils,
      JvAppXMLStorage;
    
    type
      MyRecord= record
          Field1 : Integer;
          Field2 : Double;
          Field3 : String[20];
          Field4 : String[20];
      end;
    
    Procedure SaveMyRecord(Rec : MyRecord);
    var
      MyStore: TJvAppXMLFileStorage;
    begin
      MyStore:= TJvAppXMLFileStorage.Create(nil);
      try
        MyStore.FileName:='C:\temp\record.xml';
        MyStore.WriteBinary('Dummy', @Rec,sizeof(Rec));
        MyStore.Xml.SaveToFile(MyStore.FileName);
      finally
        MyStore.Free;
      end;
    end;
    
    Procedure LoadMyRecord(var Rec : MyRecord);
    var
      MyStore: TJvAppXMLFileStorage;
    begin
      MyStore:= TJvAppXMLFileStorage.Create(nil);
      try
        MyStore.FileName:='C:\temp\record.xml';
        MyStore.Xml.LoadFromFile(MyStore.FileName);
        MyStore.ReadBinary('Dummy', @Rec,sizeof(Rec));
      finally
        MyStore.Free;
      end;
    end;
    
    
    Var
        Rec :  MyRecord;
    begin
      //Fill the record
      Rec.Field1:=900;
      Rec.Field2:=7.8;
      Rec.Field3:='string test 1';
      Rec.Field4:='string test 2';
      SaveMyRecord(Rec); //save the record
      FillChar(Rec,SizeOf(Rec),#0); //clear the record variable
      LoadMyRecord(Rec);//restire the record data
      //show the loaded data
      Writeln(rec.field1);
      Writeln(rec.field2);
      Writeln(rec.field3);
      Writeln(rec.field4);
      Readln;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any utilities that reformat Delphi code ? EDIT I am using Delphi
Are there any tools that can generate dependency diagrams for Delphi units taking into
Is there any work-around to create mutual referencing records in Delphi? Here's the simplified
Is there any way that I can have the Delphi IDE auto-save all opened
Are there any classes (free, open source or commercial) that perform access control similar
Is there any Delphi D2010 function like PosEx that finds a sub-string inside a
Is there any Delphi expert or similar that allows me to automatically find all
Are there any CI-Systems for Delphi like Hudson for Java? Does Hudson has any
Is there any equivalent of DocTest for Delphi. I use DUnit but I like
Is there any GUI toolkit for Python with form designer similar to Delphi, eg

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.