private void OnAddRow(DataRow row)
{
// Xml operations in this func should not trigger ROM operations
Debug.Assert(_ignoreXmlEvents == true);
XmlBoundElement rowElement = (XmlBoundElement)(GetElementFromRow(row));
Debug.Assert(rowElement != null);
if (NeedXSI_NilAttr(row) && !rowElement.IsFoliated)
//we need to foliate it because we need to add one more attribute xsi:nil = true;
ForceFoliation(rowElement, AutoFoliationState);
Debug.Assert(rowElement != null);
DataRow rowDocElem = GetRowFromElement(DocumentElement);
if (rowDocElem != null)
{
DataRow parentRow = GetNestedParent(row);
if (parentRow == null)
DemoteDocumentElement();
}
EnsureDocumentElement().AppendChild(rowElement);
// Move the children of the row under
FixNestedChildren(row, rowElement);
OnNestedParentChange(row, rowElement, null);
}