private void LoadRowData(DataRow row, XmlElement rowElement)
{
DataTable table = row.Table;
if (this.FromInference)
{
table.Prefix = rowElement.Prefix;
}
Hashtable hashtable = new Hashtable();
row.BeginEdit();
XmlNode firstChild = rowElement.FirstChild;
DataColumn textOnlyColumn = this.GetTextOnlyColumn(row);
if (textOnlyColumn != null)
{
hashtable[textOnlyColumn] = textOnlyColumn;
string valueForTextOnlyColums = this.GetValueForTextOnlyColums(firstChild);
if (XMLSchema.GetBooleanAttribute(rowElement, "nil", "http://www.w3.org/2001/XMLSchema-instance", false) && ADP.IsEmpty(valueForTextOnlyColums))
{
row[textOnlyColumn] = DBNull.Value;
}
else
{
this.SetRowValueFromXmlText(row, textOnlyColumn, valueForTextOnlyColums);
}
}
while ((firstChild != null) && (firstChild != rowElement))
{
if (firstChild.NodeType == XmlNodeType.Element)
{
XmlElement node = (XmlElement)firstChild;
object schemaForNode = this.nodeToSchemaMap.GetSchemaForNode(node, this.FIgnoreNamespace(node));
if ((schemaForNode is DataTable) && this.FColumnElement(node))
{
schemaForNode = this.nodeToSchemaMap.GetColumnSchema(node, this.FIgnoreNamespace(node));
}
if ((schemaForNode == null) || (schemaForNode is DataColumn))
{
firstChild = node.FirstChild;
if ((schemaForNode != null) && (schemaForNode is DataColumn))
{
DataColumn col = (DataColumn)schemaForNode;
if (((col.Table == row.Table) && (col.ColumnMapping != MappingType.Attribute)) && (hashtable[col] == null))
{
hashtable[col] = col;
string str = this.GetValueForTextOnlyColums(firstChild);
if (XMLSchema.GetBooleanAttribute(node, "nil", "http://www.w3.org/2001/XMLSchema-instance", false) && ADP.IsEmpty(str))
{
row[col] = DBNull.Value;
}
else
{
this.SetRowValueFromXmlText(row, col, str);
}
}
}
else if ((schemaForNode == null) && (firstChild != null))
{
continue;
}
if (firstChild == null)
{
firstChild = node;
}
}
}
while ((firstChild != rowElement) && (firstChild.NextSibling == null))
{
firstChild = firstChild.ParentNode;
}
if (firstChild != rowElement)
{
firstChild = firstChild.NextSibling;
}
}
foreach (XmlAttribute attribute in rowElement.Attributes)
{
object columnSchema = this.nodeToSchemaMap.GetColumnSchema(attribute, this.FIgnoreNamespace(attribute));
if ((columnSchema != null) && (columnSchema is DataColumn))
{
DataColumn column3 = (DataColumn)columnSchema;
if ((column3.ColumnMapping == MappingType.Attribute) && (hashtable[column3] == null))
{
hashtable[column3] = column3;
firstChild = attribute.FirstChild;
this.SetRowValueFromXmlText(row, column3, this.GetInitialTextFromNodes(ref firstChild));
}
}
}
foreach (DataColumn column in row.Table.Columns)
{
if ((hashtable[column] == null) && XmlToDatasetMap.IsMappedColumn(column))
{
if (!column.AutoIncrement)
{
if (column.AllowDBNull)
{
row[column] = DBNull.Value;
}
else
{
row[column] = column.DefaultValue;
}
}
else
{
column.Init(row.tempRecord);
}
}
}
row.EndEdit();
}