protected SchemaSerializationMode DetermineSchemaSerializationMode(XmlReader reader)
{
//Typed DataSet calls into this
SchemaSerializationMode schemaSerializationMode = SchemaSerializationMode.IncludeSchema;
reader.MoveToContent();
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.HasAttributes)
{
string attribValue = reader.GetAttribute(Keywords.MSD_SCHEMASERIALIZATIONMODE, Keywords.MSDNS);
if (string.Equals(attribValue, Keywords.MSD_EXCLUDESCHEMA, StringComparison.OrdinalIgnoreCase))
{
schemaSerializationMode = SchemaSerializationMode.ExcludeSchema;
}
else if (string.Equals(attribValue, Keywords.MSD_INCLUDESCHEMA, StringComparison.OrdinalIgnoreCase))
{
schemaSerializationMode = SchemaSerializationMode.IncludeSchema;
}
else if (attribValue != null)
{
// if attrib does not exist, then don't throw
throw ExceptionBuilder.InvalidSchemaSerializationMode(typeof(SchemaSerializationMode), attribValue);
}
}
}
return schemaSerializationMode;
}