Access violation when loading a TClientDataset from XML


I have a TClientdataset instance that has been saved to a string (using the SaveToStream method).
When I load the string back into another TClientDataset instance I get an access violation in midas.dll at address 0018DDD6, read address 00000000.

The xml I am loading is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> BillingRunID="21798" FromDateTime="20230831" ToDateTime="20231111T23:59:59999"

Has anyone got any ideas on how to fix this problem.

I am currently running Delphi 11 Version 28.44500.8973 and Windows 10 version 22H2 OS build 19045.3570 64-bit)

To get the error, drop a TClientDataset on a form, right-click the icon and chose ‘Load from MyBase table’. The file to choose is an xml file using the above text.


Seems as though some of my xml is missing.

I have attached it below
ADUG CDS.LoadFromStream (579 Bytes)

When posting code or markup, you need to tell discourse what it is, to do that add a line with 3 backtics and then the language (for highlighting) and the end it with 3 backticks on a separate line

code/xml goes here

I formatted it for easier reading (original had no line breaks).

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DATAPACKET Version="2.0">
			<FIELD attrname="QueueIDs" fieldtype="nested">
					<FIELD attrname="QueueID" fieldtype="i8"/>
					<FIELD attrname="LINK_FIELD" fieldtype="ui4" hidden="true" linkfield="true"/>
				<PARAMS CHANGE_LOG="1 0 4"/>
			<FIELD attrname="BillingRunID" fieldtype="i8"/>
			<FIELD attrname="FromDateTime" fieldtype="dateTime"/>
			<FIELD attrname="ToDateTime" fieldtype="dateTime"/>
			<FIELD attrname="ClientIDs" fieldtype="nested">
					<FIELD attrname="ClientID" fieldtype="i8"/>
					<FIELD attrname="Successfull" fieldtype="boolean"/>
					<FIELD attrname="ResultInfo" fieldtype="bin.hex" SUBTYPE="Text"/>
					<FIELD attrname="LINK_FIELD" fieldtype="ui4" hidden="true" linkfield="true"/>
				<PARAMS CHANGE_LOG="1 0 4"/>
		<PARAMS CHANGE_LOG="1 0 4 1 2 64 1 1 64"/>
		<ROW RowState="4">
				<ROWQueueIDs RowState="4" QueueID="1" LINK_FIELD="1"/>
			</QueueIDs> BillingRunID="21798" FromDateTime="20230831" ToDateTime="20231111T23:59:59999"
				<ROWClientIDs RowState="4" ClientID="21555" LINK_FIELD="1"/>

Thanks Vincent

I will try and remember your instructions for next time.

With respect to my problem it appears that the TClientDataset that has
nested datasets can use the SaveToFile/SaveToStream methods but cannot
load the resultant data using the LoadFromFile/LoadFromStream methods.

I am assuming that in order to use nested datasets a secondary
ClientDataset is required to store/use the nested dataset data.

In my case there is nested data but not CDS to store the data. Hence the
AV on address zero.


Does XML Mapper help with this? I seem to remember doing something with nested xml data in the past.