# File lib/wsdl/soap/classDefCreatorSupport.rb, line 105
  def create_type_name(modulepath, element)
    if element.type == XSD::AnyTypeName
      # nil means anyType.
      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?
      # inner class
      mapped_class_name(element.name, modulepath)
    else
      nil
    end
  end