internal bool MoveToFirst()
{
RealFoliate();
AssertValid();
if (_node != null)
{
DataRow curRow = null;
XmlNode parent = null;
if (_column != null)
{
curRow = Row;
parent = _node;
}
else
{
parent = _node.ParentNode;
if (parent == null)
return false;
if (!IsFoliated(parent) && (parent is XmlBoundElement))
curRow = ((XmlBoundElement)parent).Row;
}
//first check with the columns in the row
if (curRow != null)
{
DataColumn c = NextColumn(curRow, null, false);
while (c != null)
{
if (IsValidChild(_node, c))
{
MoveTo(_node, c, _doc.IsTextOnly(c));
return true;
}
c = NextColumn(curRow, c, false);
}
}
//didn't find a valid column or maybe already Foliated, go through its children nodes
XmlNode n = _doc.SafeFirstChild(parent);
while (n != null)
{
if (IsValidChild(parent, n))
{
MoveTo(n);
return true;
}
n = _doc.SafeNextSibling(n);
}
}
return false;
}