private MemberMapping[] ImportTypeMembers(XmlSchemaType type, string typeNs, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, ref bool needExplicitOrder, bool order, bool allowUnboundedElements)
{
TypeItems items = GetTypeItems(type);
bool mixed = IsMixed(type);
if (mixed)
{
// check if we can transfer the attribute to the base class
XmlSchemaType t = type;
while (!t.DerivedFrom.IsEmpty)
{
t = FindType(t.DerivedFrom, TypeFlags.CanBeElementValue | TypeFlags.CanBeTextValue);
if (IsMixed(t))
{
// keep the mixed attribute on the base class
mixed = false;
break;
}
}
}
if (items.Particle != null)
{
ImportGroup(items.Particle, identifier, members, membersScope, elementsScope, typeNs, mixed, ref needExplicitOrder, order, items.IsUnbounded, allowUnboundedElements);
}
for (int i = 0; i < items.Attributes.Count; i++)
{
object item = items.Attributes[i];
if (item is XmlSchemaAttribute)
{
ImportAttributeMember((XmlSchemaAttribute)item, identifier, members, membersScope, typeNs);
}
else if (item is XmlSchemaAttributeGroupRef)
{
XmlQualifiedName groupName = ((XmlSchemaAttributeGroupRef)item).RefName;
ImportAttributeGroupMembers(FindAttributeGroup(groupName), identifier, members, membersScope, groupName.Namespace);
}
}
if (items.AnyAttribute != null)
{
ImportAnyAttributeMember(items.AnyAttribute, members, membersScope);
}
if (items.baseSimpleType != null || (items.Particle == null && mixed))
{
ImportTextMember(members, membersScope, mixed ? null : items.baseSimpleType);
}
ImportXmlnsDeclarationsMember(type, members, membersScope);
MemberMapping[] typeMembers = (MemberMapping[])members.ToArray(typeof(MemberMapping));
return typeMembers;
}