private static void ProcessSequence( SchemaValidationResult errors, XmlSchemaSequence sequence,
ICollection collection,
decimal minOccurrs)
{
foreach (XmlSchemaObject item in sequence.Items)
{
var se = item as XmlSchemaElement;
var gr = item as XmlSchemaGroupRef;
var sc = item as XmlSchemaChoice;
var ss = item as XmlSchemaSequence;
var sa = item as XmlSchemaAny;
if (se != null)
{
decimal max = se.MaxOccurs;
decimal min = se.MinOccurs;
string maxString = se.MaxOccursString;
string minString = se.MinOccursString;
if (collection.Count > max)
errors.AddError( string.Format( "{0} count may not be more than {1}", se.Name,
string.IsNullOrEmpty( maxString ) ? "" + max : maxString ) );
if (collection.Count < min && minOccurrs > 0)
errors.AddError( string.Format( "{0} count may not be less than {1}", se.Name,
( string.IsNullOrEmpty( minString ) ? "" + min : minString ) ) );
}
else if (sc != null)
{
foreach (XmlSchemaObject scItem in sc.Items)
{
var scse = scItem as XmlSchemaElement;
var scgr = scItem as XmlSchemaGroupRef;
var scsc = scItem as XmlSchemaChoice;
var scss = scItem as XmlSchemaSequence;
var scsa = scItem as XmlSchemaAny;
}
}
else if (ss != null)
{
//ProcessSequence(errors, ss, ICollection collection,
}
}
}