private SchemaElementDecl FastGetElementDecl(XmlQualifiedName elementName, object particle)
{
SchemaElementDecl elementDecl = null;
if (particle != null)
{
XmlSchemaElement element = particle as XmlSchemaElement;
if (element != null)
{
elementDecl = element.ElementDecl;
}
else
{
XmlSchemaAny any = (XmlSchemaAny)particle;
_processContents = any.ProcessContentsCorrect;
}
}
if (elementDecl == null && _processContents != XmlSchemaContentProcessing.Skip)
{
if (_isRoot && _partialValidationType != null)
{
if (_partialValidationType is XmlSchemaElement)
{
XmlSchemaElement element = (XmlSchemaElement)_partialValidationType;
if (elementName.Equals(element.QualifiedName))
{
elementDecl = element.ElementDecl;
}
else
{
SendValidationEvent(SR.Sch_SchemaElementNameMismatch, elementName.ToString(), element.QualifiedName.ToString());
}
}
else if (_partialValidationType is XmlSchemaType)
{ //Element name is wildcard
XmlSchemaType type = (XmlSchemaType)_partialValidationType;
elementDecl = type.ElementDecl;
}
else
{ //its XmlSchemaAttribute
Debug.Assert(_partialValidationType is XmlSchemaAttribute);
SendValidationEvent(SR.Sch_ValidateElementInvalidCall, string.Empty);
}
}
else
{
elementDecl = _compiledSchemaInfo.GetElementDecl(elementName);
}
}
return elementDecl;
}