MG: accelerated xml

git-svn-id: trunk@3369 -
This commit is contained in:
lazarus 2002-09-20 09:27:47 +00:00
parent 3443807a79
commit 652ff7ba3f
2 changed files with 22 additions and 13 deletions

View File

@ -209,7 +209,8 @@ end;
procedure TXMLConfig.SetFilename(const AFilename: String); procedure TXMLConfig.SetFilename(const AFilename: String);
var var
f: File; MemStream: TMemoryStream;
ok: boolean;
cfg: TDOMElement; cfg: TDOMElement;
begin begin
{$IFDEF MEM_CHECK}CheckHeapWrtMemCnt('TXMLConfig.SetFilename A '+AFilename);{$ENDIF} {$IFDEF MEM_CHECK}CheckHeapWrtMemCnt('TXMLConfig.SetFilename A '+AFilename);{$ENDIF}
@ -225,18 +226,20 @@ begin
doc.Free; doc.Free;
end; end;
AssignFile(f, AFileName); doc:=nil;
{$I-} MemStream:=TMemoryStream.Create;
Reset(f, 1); try
{$I+}
if IOResult = 0 then
try try
{$IFDEF MEM_CHECK}CheckHeapWrtMemCnt('TXMLConfig.SetFilename B');{$ENDIF} ok:=false;
ReadXMLFile(doc, f); MemStream.LoadFromFile(AFilename);
{$IFDEF MEM_CHECK}CheckHeapWrtMemCnt('TXMLConfig.SetFilename C');{$ENDIF} ok:=true;
finally except
CloseFile(f);
end; end;
if ok then
ReadXMLFile(doc,MemStream);
finally
MemStream.Free;
end;
if not Assigned(doc) then if not Assigned(doc) then
doc := TXMLDocument.Create; doc := TXMLDocument.Create;
@ -253,6 +256,9 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.4 2002/09/20 09:27:47 lazarus
MG: accelerated xml
Revision 1.3 2002/09/13 16:58:27 lazarus Revision 1.3 2002/09/13 16:58:27 lazarus
MG: removed the 1x1 bitmap from TBitBtn MG: removed the 1x1 bitmap from TBitBtn

View File

@ -124,13 +124,13 @@ begin
stream.WriteByte(10); stream.WriteByte(10);
end; end;
procedure wrtStr(s: string); procedure wrtStr(const s: string);
begin begin
if s<>'' then if s<>'' then
wrt(s[1],length(s)); wrt(s[1],length(s));
end; end;
procedure wrtStrLn(s: string); procedure wrtStrLn(const s: string);
begin begin
if s<>'' then if s<>'' then
wrtln(s[1],length(s)); wrtln(s[1],length(s));
@ -479,6 +479,9 @@ end.
{ {
$Log$ $Log$
Revision 1.4 2002/09/20 09:27:47 lazarus
MG: accelerated xml
Revision 1.3 2002/08/04 07:44:44 lazarus Revision 1.3 2002/08/04 07:44:44 lazarus
MG: fixed xml reading writing of special chars MG: fixed xml reading writing of special chars