private XmlSchemaElement GetSchemaElement()
{
SchemaElementDecl beforeXsiDecl = _context.ElementDeclBeforeXsi;
SchemaElementDecl currentDecl = _context.ElementDecl;
if (beforeXsiDecl != null)
{ //Have a xsi:type
if (beforeXsiDecl.SchemaElement != null)
{
XmlSchemaElement xsiElement = (XmlSchemaElement)beforeXsiDecl.SchemaElement.Clone(null);
xsiElement.SchemaTypeName = XmlQualifiedName.Empty; //Reset typeName on element as this might be different
xsiElement.SchemaType = currentDecl.SchemaType;
xsiElement.SetElementType(currentDecl.SchemaType);
xsiElement.ElementDecl = currentDecl;
return xsiElement;
}
}
return currentDecl.SchemaElement;
}