private void GenerateTableErrors(DataTable table)
{
int rowCount = table.Rows.Count;
int colCount = table.Columns.Count;
if (rowCount <= 0)
return;
for (int rowNum = 0; rowNum < rowCount; ++rowNum)
{
bool tableName = false;
DataRow row = table.Rows[rowNum];
string prefix = (table.Namespace.Length != 0) ? table.Prefix : string.Empty;
if ((row.HasErrors) && (row.RowError.Length > 0))
{
if (!_fErrors)
{
_xmlw.WriteStartElement(Keywords.DFF, Keywords.MSD_ERRORS, Keywords.DFFNS);
_fErrors = true;
}
_xmlw.WriteStartElement(prefix, row.Table.EncodedTableName, row.Table.Namespace);
_xmlw.WriteAttributeString(Keywords.DFF, Keywords.DIFFID, Keywords.DFFNS, row.Table.TableName + row.rowID.ToString(CultureInfo.InvariantCulture));
_xmlw.WriteAttributeString(Keywords.DFF, Keywords.MSD_ERROR, Keywords.DFFNS, row.RowError);
tableName = true;
}
if (colCount <= 0)
continue;
for (int colNum = 0; colNum < colCount; ++colNum)
{
DataColumn column = table.Columns[colNum];
string error = row.GetColumnError(column);
string columnPrefix = (column.Namespace.Length != 0) ? column.Prefix : string.Empty;
if (error == null || error.Length == 0)
{
continue;
}
if (!tableName)
{
if (!_fErrors)
{
_xmlw.WriteStartElement(Keywords.DFF, Keywords.MSD_ERRORS, Keywords.DFFNS);
_fErrors = true;
}
_xmlw.WriteStartElement(prefix, row.Table.EncodedTableName, row.Table.Namespace);
_xmlw.WriteAttributeString(Keywords.DFF, Keywords.DIFFID, Keywords.DFFNS, row.Table.TableName + row.rowID.ToString(CultureInfo.InvariantCulture));
tableName = true;
}
_xmlw.WriteStartElement(columnPrefix, column.EncodedColumnName, column.Namespace);
_xmlw.WriteAttributeString(Keywords.DFF, Keywords.MSD_ERROR, Keywords.DFFNS, error);
_xmlw.WriteEndElement();
}
if (tableName)
_xmlw.WriteEndElement();
}
}