internal override bool NextRight()
{
// Make sure we do not get past the nodeTop if we call NextRight on a just initialized iterator and nodeTop has no children
if (_currentNode == _nodeTop)
{
_currentNode = null;
return false;
}
XmlNode nextNode = _currentNode.NextSibling;
if (nextNode != null)
{
_currentNode = nextNode;
return true;
}
// No next sibling, try the first sibling of from the parent chain
nextNode = _currentNode;
while (nextNode != _nodeTop && nextNode.NextSibling == null)
{
nextNode = nextNode.ParentNode;
}
if (nextNode == _nodeTop)
{
_currentNode = null;
return false;
}
_currentNode = nextNode.NextSibling;
Debug.Assert(_currentNode != null);
return true;
}
}