Dennis1000/verysimplexml

TXmlNodeList.NextSibling & PreviousSibling not inc/decrementing

GoogleCodeExporter opened this issue · 0 comments

What steps will reproduce the problem?
1. Call aNode.NextSibling and sit in infinite loop


function TXmlNodeList.NextSibling(Node: TXmlNode): TXmlNode;
var
  Index: Integer;
begin
  if (not assigned(Node)) and (Count > 0) then
    Result := First
  else
  begin
    Index := Self.IndexOf(Node);
    if (Index >= 0) and (Index + 1 < Count) then
      Result := Self[Index + 1]  //<- fix
    else
      Result := NIL;
  end;
end;

function TXmlNodeList.PreviousSibling(Node: TXmlNode): TXmlNode;
var
  Index: Integer;
begin
  Index := Self.IndexOf(Node);
  if Index - 1 >= 0 then
    Result := Self[Index - 1]  //<- fix
  else
    Result := NIL;
end;

Thank you for making my XML life easier ;-)


Original issue reported on code.google.com by lystak...@gmail.com on 20 Oct 2014 at 11:37