laz_xml: fixed TXMLConfig.Create(nil)

git-svn-id: trunk@31616 -
This commit is contained in:
mattias 2011-07-09 09:54:02 +00:00
parent 07768dff6b
commit 4c0026a1c7
2 changed files with 9 additions and 3 deletions

View File

@ -84,7 +84,7 @@ procedure TMyApplication.Test1;
x1:=Laz_XMLCfg.TXMLConfig.Create(Filename)
else
x2:=Laz2_XMLCfg.TXMLConfig.Create(Filename);
for i:=8 to 13 do begin
for i:=1 to 130 do begin
CheckValue('Item'+IntToStr(i)+'/Value',chr(i));
end;
CheckValue('AUmlaut/Value','Ä');

View File

@ -75,6 +75,7 @@ type
CreateNodes: boolean = false): TDomNode;
procedure InternalCleanNode(Node: TDomNode);
public
constructor Create(AOwner: TComponent); override;
constructor Create(const AFilename: String); overload; // create and load
constructor CreateClean(const AFilename: String); // create new
constructor CreateWithSource(const AFilename, Source: String); // create new and load from Source
@ -136,14 +137,19 @@ type
implementation
constructor TXMLConfig.Create(const AFilename: String);
constructor TXMLConfig.Create(AOwner: TComponent);
begin
//DebugLn(['TXMLConfig.Create ',AFilename]);
{$IFDEF NewXMLCfg}
// for compatibility with old TXMLConfig, which wrote #13 as #13, not as &xD;
FReadFlags:=[xrfAllowLowerThanInAttributeValue,xrfAllowSpecialCharsInAttributeValue];
// for compatibility with old TXMLConfig, which can not read &xD;, but needs #13
FWriteFlags:=[xwfSpecialCharsInAttributeValue];
{$ENDIF}
inherited Create(AOwner);
end;
constructor TXMLConfig.Create(const AFilename: String);
begin
inherited Create(nil);
SetFilename(AFilename);
end;