laz2xmlcfg: duplicate nodes: always use the first

git-svn-id: trunk@47171 -
This commit is contained in:
mattias 2014-12-10 11:26:47 +00:00
parent 890803a8be
commit 98578ff53a
2 changed files with 11 additions and 2 deletions

View File

@ -612,7 +612,13 @@ begin
end;
SetLength(Children,aCount);
if aCount>1 then
MergeSort(@Children[0],aCount,@CompareDomNodeNames); // soet ascending [0]<[1]
MergeSort(@Children[0],aCount,@CompareDomNodeNames); // sort ascending [0]<[1]
for m:=0 to aCount-2 do
if Children[m].NodeName=Children[m+1].NodeName then begin
// duplicate found: nodes with same name
// -> use only the first
Children[m+1]:=Children[m];
end;
ChildrenValid:=true;
end;

View File

@ -9,8 +9,11 @@ uses
function ComparePointers(p1, p2: Pointer): integer; inline;
{ MergeSort:
sort ascending, e.g. Compare(List[0],List[1])<0
keeping order (for each i<j and Compare(List[i],List[j])=0) }
procedure MergeSort(List: PPointer; ListLength: PtrInt;
const Compare: TListSortCompare); // sort ascending, e.g. Compare(List[0],List[1])<0
const Compare: TListSortCompare);
function GetNextDelimitedItem(const List: string; Delimiter: char;
var Position: integer): string;