1
0
mirror of synced 2024-11-23 06:03:50 +00:00

Fixed: SortChildNodes could cause "Line too long" error on large documents

This commit is contained in:
Mark van Renswoude 2014-08-05 12:03:22 +00:00
parent aa29f0463e
commit dc29a0ae51
2 changed files with 12 additions and 5 deletions

View File

@ -1549,7 +1549,13 @@ begin
end; end;
end else if not propertyItem.IsNodeValue then end else if not propertyItem.IsNodeValue then
begin begin
elementSortOrder := elementSortOrder + ', ' + QuotedStr(propertyItem.Name); elementSortOrder := elementSortOrder + ', ';
{ Prevent "Line too long" on large elements }
if (elementSortCount > 0) and (elementSortCount mod 5 = 0) then
elementSortOrder := elementSortOrder + XSDValidateMethodImplementationSortNewLine;
elementSortOrder := elementSortOrder + QuotedStr(propertyItem.Name);
Inc(elementSortCount); Inc(elementSortCount);
if (not propertyItem.IsOptional) and (not propertyItem.IsRepeating) then if (not propertyItem.IsOptional) and (not propertyItem.IsRepeating) then

View File

@ -104,10 +104,11 @@ const
XSDValidateMethodImplementationBegin = 'procedure TXML%<Name>:s.XSDValidate;' + CrLf + XSDValidateMethodImplementationBegin = 'procedure TXML%<Name>:s.XSDValidate;' + CrLf +
'begin'; 'begin';
XSDValidateMethodImplementationRequired = ' CreateRequiredElements(Self, [%<RequiredElements>:s]);'; XSDValidateMethodImplementationRequired = ' CreateRequiredElements(Self, [%<RequiredElements>:s]);';
XSDValidateMethodImplementationComplex = ' Get%<Name>:s;'; XSDValidateMethodImplementationComplex = ' Get%<Name>:s;';
XSDValidateMethodImplementationAttrib = ' CreateRequiredAttributes(Self, [%<RequiredAttributes>:s]);'; XSDValidateMethodImplementationAttrib = ' CreateRequiredAttributes(Self, [%<RequiredAttributes>:s]);';
XSDValidateMethodImplementationSort = ' SortChildNodes(Self, [%<SortOrder>:s]);'; XSDValidateMethodImplementationSort = ' SortChildNodes(Self, [%<SortOrder>:s]);';
XSDValidateMethodImplementationSortNewLine = #13#10 + ' ';
XSDValidateMethodImplementationEnd = 'end;' + CrLf; XSDValidateMethodImplementationEnd = 'end;' + CrLf;