在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;
解决方案 »
- 关于adoquery的过滤属性
- 各位大侠:如何用一支程式控制另外一支程式在规定时间关闭
- 会Delphi 的朋友都可以进来
- 调查一下,大家都有delphi哪个版本?
- 函数返回参数可以是一个包含多个结果的集合吗(分不够再加)
- 小问题!在线等待!立即给分!
- ado联结SQLserver,为何不能写数据库?
- 我想想大家请教一个问题:关于使用Ms SQL Server
- 关于数据库中图象的存取问题,100全送!
- 谁有fastreport报表系统中使用自定义数组来获取数据的源代码...? 我给100分,不够可再加分?
- 各位大虾,怎么样来响应 _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;