使用TXMLDocument的时候疑问重重,如以下代码所示,thisDoc看上去只能被访问一次,当第二次访问的时候,则会抛出异常,导致访问失败。以下代码执行到18行时正常,并且i的值是1属于正确值,但是重复执行一次,执行到19行时,则抛出异常,以下是异常信息Exception captured:EAccessViolation
Message:Access violation at address 022238DD in module 'HISISDK.dll'. Read of address 6579223D
procedure testProcedure();
var
sXml:string;
thisDoc:TXMLDocument;
i:Integer;
begin
sXml := '<bubble version="1.0" vin="1">' +
'<vin0 stream="3">' +
'<stream0 name="720p.264" size="1280x720" x1="yes" x2="yes" x4="yes" />' +
'<stream1 name="360p.264" size="640x360" x1="yes" x2="yes" x4="yes" />' +
'<stream2 name="qvga.264" size="320x240" x1="yes" x2="yes" x4="yes" />' +
'</vin0>' +
'</bubble>';
thisDoc := TXMLDocument.Create(nil);
thisDoc.LoadFromStream(TStringStream.Create(sXml));
try
begin
i := thisDoc.ChildNodes.Count;
i := thisDoc.ChildNodes.Count;
i := thisDoc.ChildNodes.Count;
end;
except
on E:Exception do tracelog('Exception captured:' + E.ClassName + #13#10 +
'Message:' + E.Message);
end;
thisDoc.Free;
end;delphiTXMLDocument读取
Message:Access violation at address 022238DD in module 'HISISDK.dll'. Read of address 6579223D
procedure testProcedure();
var
sXml:string;
thisDoc:TXMLDocument;
i:Integer;
begin
sXml := '<bubble version="1.0" vin="1">' +
'<vin0 stream="3">' +
'<stream0 name="720p.264" size="1280x720" x1="yes" x2="yes" x4="yes" />' +
'<stream1 name="360p.264" size="640x360" x1="yes" x2="yes" x4="yes" />' +
'<stream2 name="qvga.264" size="320x240" x1="yes" x2="yes" x4="yes" />' +
'</vin0>' +
'</bubble>';
thisDoc := TXMLDocument.Create(nil);
thisDoc.LoadFromStream(TStringStream.Create(sXml));
try
begin
i := thisDoc.ChildNodes.Count;
i := thisDoc.ChildNodes.Count;
i := thisDoc.ChildNodes.Count;
end;
except
on E:Exception do tracelog('Exception captured:' + E.ClassName + #13#10 +
'Message:' + E.Message);
end;
thisDoc.Free;
end;delphiTXMLDocument读取
解决方案 »
- 两个Dbgrid表数据自动进行比较的问题请教???
- 超头痛,在退出程序时出错,请DELHPI高手指点迷经!TKS
- 紧急求救:会的不会的都要看看的问题!
- 如何截获某一个端口的数据包?并加以分析?
- access问题!
- 请问如何把stringgrid的不同列设为不同的颜色?在线等,谢谢回答
- 怎样在后台打开网页的源文件并进行代码分析?
- 在线等待!!!Printer.TextOut输出时的位置问题!
- 我写了一个在DOS下运行的程序,但有一些问题, 请大家看一下很容易的.
- 请问:BDE能同时维持多少个BDE会话期间呢??(既,同时能建立几个对specific database的联结
- xmlhttp缓存问题。
- 求Dephi7设计电子地图方法?
begin
if not Assigned(FXmlDoc) then
begin
FXmlDoc := CoDOMDocument.Create(); if FXmlDoc.load(sFileName) then
FActive := True
else
FActive := False; if FActive then
FileName := sFileName
else
FileName := '';
end;
end;procedure TXmlFactory.CloseXml;
begin
if Assigned(FXmlDoc) then FXmlDoc := nil;
FileName := '';
FActive := False;
end;
现已改为NativeXML,用的很顺手。