1

我将我的 Delphi 7 代码迁移到 Delphi XE4。我在 Delphi XE4 中的 LoadFromSram 方法中遇到错误,但在 Delphi 7 中同样可以正常工作。

错误:

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);

我在 uses 子句中使用 XMLDoc、XMLIntf、XMLDOM。

4

1 回答 1

3

您的流要么是空的(就像您从无效文件加载一样,或者其他什么,您没有提供足够的代码来告诉我们您是如何填充流的),或者正如 TLama 指出的那样,您没有重置到开头。即寻求(0);

于 2013-10-25T14:41:55.707 回答