Try this program with a corrupted xml file(just delte part of a tag or something)
Compile with -ghl and you'll get a few bytes leaked.


program xmltest;

{$mode objfpc}{$H+}

uses
 SysUtils, XMLCfg;

function LoadXML(var axml: TXmlConfig; const filename: string): boolean;
begin
 writeln('Loading');
 axml:=nil;
 result:=true;
 try
   axml:=TXMlConfig.Create(filename); // try to parse the file
 except
   on E: Exception do
     begin
       writeln('Error: '+ E.Message);
       result:=false;
     end;
 end;
 if not result then
   freeandnil(axml);
end;

var xml: TXMLConfig;
begin
 if LoadXML(xml, 'test.xml') then
   writeln('Success');
end.

_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to