I migrated my Delphi 7 code to Delphi XE4. I am getting error in the LoadFromStram method in Delphi XE4 but same is working fine for Delphi 7.
Error:
First chance exception at $7559C41F. Exception class EDOMParseError with message
'XML document must have a top level element.
Line: 0
'.
Process abc.exe (10516)
var
myStream : TStream;
....
....
LoadFromStream(myStream);
I am using XMLDoc, XMLIntf, XMLDOM in uses clause.
Position
to 0 ? - TLamamyStream.Position := 0;
, but it doesn't have to be your problem. That stream can be empty as Chris pointed out. You can check that if you evaluatemyStream.Size
property. If it's 0, then you have an empty stream and thus an invalid XML. - TLama