internal void SyncTree(XmlNode node)
{
XmlBoundElement be = null;
_mapper.GetRegion(node, out be);
DataRow parentRow = null;
bool fAddRowsToTable = IsConnected(node);
if (be != null)
{
DataRow r = be.Row;
if (r != null && be.ElementState == ElementState.Defoliated)
return; //no need of syncRow
if (r != null)
{
// get all field values.
SynchronizeRowFromRowElement(be);
// defoliation will not be done on the node which is not RowElement, in case of node is externally being used
if (node == be)
{
// defoliate if possible
be.ElementState = ElementState.WeakFoliation;
DefoliateRegion(be);
}
if (fAddRowsToTable && r.RowState == DataRowState.Detached)
r.Table.Rows.Add(r);
parentRow = r;
}
}
// Attach all rows from children nodes
for (XmlNode child = node.FirstChild; child != null; child = child.NextSibling)
SyncRows(parentRow, child, fAddRowsToTable);
}