private bool IsDatasetParticle(XmlSchemaParticle pt)
{
XmlSchemaObjectCollection items = GetParticleItems(pt);
if (items == null)
return false; // empty element, threat it as table
bool isChoice = FromInference && (pt is XmlSchemaChoice);// currently we add this support for choice, just for inference
foreach (XmlSchemaAnnotated el in items)
{
if (el is XmlSchemaElement)
{
// pushing max occur of choice element to its imidiate children of type xs:elements
if (isChoice && pt.MaxOccurs > decimal.One && (((XmlSchemaElement)el).SchemaType is XmlSchemaComplexType)) // we know frominference condition
((XmlSchemaElement)el).MaxOccurs = pt.MaxOccurs;
if (((XmlSchemaElement)el).RefName.Name.Length != 0)
{
if (!FromInference || (((XmlSchemaElement)el).MaxOccurs != decimal.One && !(((XmlSchemaElement)el).SchemaType is XmlSchemaComplexType)))
continue;
}
if (!IsTable((XmlSchemaElement)el))
return false;
continue;
}
if (el is XmlSchemaParticle)
{
if (!IsDatasetParticle((XmlSchemaParticle)el))
return false;
}
}
return true;
}