MemberMapping[] ImportTypeMembers(XmlSchemaComplexType type, string typeNs, CodeIdentifiers members) {
if (type.AnyAttribute != null) {
throw new InvalidOperationException(Res.GetString(Res.XmlInvalidAnyAttributeUse, type.Name, type.QualifiedName.Namespace));
}
XmlSchemaObjectCollection items = type.Attributes;
for (int i = 0; i < items.Count; i++) {
object item = items[i];
if (item is XmlSchemaAttributeGroup) {
throw new InvalidOperationException(Res.GetString(Res.XmlSoapInvalidAttributeUse, type.Name, type.QualifiedName.Namespace));
}
if (item is XmlSchemaAttribute) {
XmlSchemaAttribute attr = (XmlSchemaAttribute)item;
if (attr.Use != XmlSchemaUse.Prohibited) throw new InvalidOperationException(Res.GetString(Res.XmlSoapInvalidAttributeUse, type.Name, type.QualifiedName.Namespace));
}
}
if (type.Particle != null) {
ImportGroup(type.Particle, members, typeNs);
}
else if (type.ContentModel != null && type.ContentModel is XmlSchemaComplexContent) {
XmlSchemaComplexContent model = (XmlSchemaComplexContent)type.ContentModel;
if (model.Content is XmlSchemaComplexContentExtension) {
if (((XmlSchemaComplexContentExtension)model.Content).Particle != null) {
ImportGroup(((XmlSchemaComplexContentExtension)model.Content).Particle, members, typeNs);
}
}
else if (model.Content is XmlSchemaComplexContentRestriction) {
if (((XmlSchemaComplexContentRestriction)model.Content).Particle != null) {
ImportGroup(((XmlSchemaComplexContentRestriction)model.Content).Particle, members, typeNs);
}
}
}
return (MemberMapping[])members.ToArray(typeof(MemberMapping));
}