在DLL中可以操纵XML,取出IXMLNODE结点吗。我向普通应用程序一样,在Dll中操纵Xml,可是一到取出IXMLnode结点时,就出错,
不知为什么,请高手指教。(try后第三句出错,文件存在且正确,在Exe程序中通过,一到Dll就出错)。
try
XMLDoc := TXMLDocument.Create(nil);
XMLDoc.LoadFromFile(gFileName);
GisXMLDocNode := XMLDoc.DocumentElement; //功能树配置文件的DocumentElement结点
finally
XMLDoc.Free;
end;
不知为什么,请高手指教。(try后第三句出错,文件存在且正确,在Exe程序中通过,一到Dll就出错)。
try
XMLDoc := TXMLDocument.Create(nil);
XMLDoc.LoadFromFile(gFileName);
GisXMLDocNode := XMLDoc.DocumentElement; //功能树配置文件的DocumentElement结点
finally
XMLDoc.Free;
end;
解决方案 »
- SQL_SERVER查询速度
- Delphi UTF8Encode 中文乱码问题
- PE的引入模块~~
- 在Delphi里进行SQL Server 2000数据库创建和还原的问题
- 关于进销存的简单问题,急!!!
- 如何使程序有自己独立运行的剪贴板不和用户自己的剪贴板操作交叉
- 如何将Form放在Panel上
- 一个窗口怎么动态显示n多个表?谢谢,100分
- 做报表时,数据库(sqlserver)里的text字段里的内容不能自动换行,我用的RQDBText,我该怎么办呢?
- Win2000下用delphi做的Form到98下变形。。。
- 各位大虾,怎么样来响应 _Restore 接口 PercentComplete 的事件?
- 文本型字段数字倒入Excel丢失小数位,该怎么处理
Doc: TXMLDocument;
begin
Doc := TXMLDocument.Create(nil);
end;The important thing to notice is that you are passing in nil as the owner. What happens then is that TXMLDocument takes on a different behavior; it acts as a reference counted object that automatically frees itself when those references reach zero. This means that the next time you do something to Doc that causes a decrease in the reference count, you run the risk of destroying the object and invalidating your reference. The problem is that so much happens to TXMLDocument behind the scenes, inside of the VCL, that it is hard to say when exactly the reference count is getting modified. The easiest way to get around this is to use an interface pointer instead of a TXMLDocument reference, like so: var
Doc: IXMLDocument;
begin
Doc := TXMLDocument.Create(nil);
end;