internal void SyncRows(DataRow parentRow, XmlNode node, bool fAddRowsToTable)
{
XmlBoundElement be = node as XmlBoundElement;
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);
// defoliate if possible
be.ElementState = ElementState.WeakFoliation;
DefoliateRegion(be);
if (parentRow != null)
SetNestedParentRow(r, parentRow);
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);
}