1
0
mirror of synced 2024-11-14 11:09:16 +00:00

TEncoding parameter for Load...FromString helper function

This commit is contained in:
Mark van Renswoude 2014-12-09 14:26:11 +00:00
parent bebb08153e
commit 8feb95edb4
3 changed files with 4 additions and 5 deletions

View File

@ -609,7 +609,6 @@ begin
{ In ye olde days this is where we checked if XMLDataBindingUtils was required. With the
introduction of the IXSDValidate, this is practically always the case. }
AWriter.WriteLine('uses');
AWriter.WriteLine(' SysUtils,');
AWriter.WriteLine(' Variants;');
AWriter.WriteLine;
end;

View File

@ -27,6 +27,7 @@ const
'uses' + CrLf +
'%<UsesClause>:s' +
' Classes,' + CrLf +
' SysUtils,' + CrLf +
' XMLDoc,' + CrLf +
' XMLIntf,' + CrLf +
' XMLDataBindingUtils;' + CrLf +
@ -45,7 +46,7 @@ const
DocumentFunctionsInterface = ' function Get%<Name>:s(ADocument: XMLIntf.IXMLDocument): IXML%<Name>:s;' + CrLf +
' function Load%<Name>:s(const AFileName: String): IXML%<Name>:s;' + CrLf +
' function Load%<Name>:sFromStream(AStream: TStream): IXML%<Name>:s;' + CrLf +
' function Load%<Name>:sFromString(const AString: String): IXML%<Name>:s;' + CrLf +
' function Load%<Name>:sFromString(const AString: String{$IF CompilerVersion >= 20}; AEncoding: TEncoding = nil; AOwnsEncoding: Boolean = True{$IFEND}): IXML%<Name>:s;' + CrLf +
' function New%<Name>:s: IXML%<Name>:s;' + CrLf;
DocumentFunctionsImplementation = 'function Get%<Name>:s(ADocument: XMLIntf.IXMLDocument): IXML%<Name>:s;' + CrLf +
@ -68,12 +69,12 @@ const
' Result := Get%<Name>:s(doc);' + CrLf +
'end;' + CrLf +
'' + CrLf +
'function Load%<Name>:sFromString(const AString: String): IXML%<Name>:s;' + CrLf +
'function Load%<Name>:sFromString(const AString: String{$IF CompilerVersion >= 20}; AEncoding: TEncoding; AOwnsEncoding: Boolean{$IFEND}): IXML%<Name>:s;' + CrLf +
'var' + CrLf +
' stream: TStringStream;' + CrLf +
'' + CrLf +
'begin' + CrLf +
' stream := TStringStream.Create(AString);' + CrLf +
' stream := TStringStream.Create(AString{$IF CompilerVersion >= 20}, AEncoding, AOwnsEncoding{$IFEND});' + CrLf +
' try' + CrLf +
' Result := Load%<Name>:sFromStream(stream);' + CrLf +
' finally' + CrLf +

View File

@ -704,7 +704,6 @@ var
schemaDef: IXMLSchemaDef;
attributeIndex: Integer;
attribute: IXMLAttributeDef;
item: TXMLDataBindingItem;
begin
schemaDef := ASchema.SchemaDef;