private TableSchemaInfo AddTableSchema(DataTable table, XmlNameTable nameTable)
{
// SDUB: Because in our case reader already read the document all names that we can meet in the
// document already has an entry in NameTable.
// If in future we will build identity map before reading XML we can replace Get() to Add()
// Sdub: GetIdentity is called from two places: BuildIdentityMap() and LoadRows()
// First case deals with decoded names; Second one with encoded names.
// We decided encoded names in first case (instead of decoding them in second)
// because it save us time in LoadRows(). We have, as usual, more data them schemas
string tableLocalName = nameTable.Get(table.EncodedTableName);
string tableNamespace = nameTable.Get(table.Namespace);
if (tableLocalName == null)
{
// because name of this table isn't present in XML we don't need mapping for it.
// Less mapping faster we work.
return null;
}
TableSchemaInfo tableSchemaInfo = new TableSchemaInfo(table);
_tableSchemaMap[new XmlNodeIdentety(tableLocalName, tableNamespace)] = tableSchemaInfo;
return tableSchemaInfo;
}