def create_type_name(modulepath, element)
if element.type == XSD::AnyTypeName
nil
elsif simpletype = @simpletypes[element.type]
if simpletype.restriction and simpletype.restriction.enumeration?
mapped_class_name(element.type, modulepath)
else
nil
end
elsif klass = element_basetype(element)
klass.name
elsif element.type
mapped_class_name(element.type, modulepath)
elsif element.ref
mapped_class_name(element.ref, modulepath)
elsif element.anonymous_type?
mapped_class_name(element.name, modulepath)
else
nil
end
end