def set_attribute(namespace, key, value = :default)
      if value == :default
        value = key
        key = namespace
        namespace = ""
      end

      raise ArgumentError, "attribute namespace must be a String" unless namespace.is_a? String
      raise ArgumentError, "attribute key must be a String" unless key.is_a? String
      raise ArgumentError, "attribute key cannot be empty" if key.empty?

      SDL4R.validate_identifier(namespace) unless namespace.empty?
      SDL4R.validate_identifier(key)

      attributes = @attributesByNamespace[namespace]
      
      if attributes.nil?
        attributes = {}
        @attributesByNamespace[namespace] = attributes
      end
      
      attributes[key] = SDL4R.coerce_or_fail(value)
    end
def set_attribute(namespace, key, value = :default)
      if value == :default
        value = key
        key = namespace
        namespace = ""
      end

      raise ArgumentError, "attribute namespace must be a String" unless namespace.is_a? String
      raise ArgumentError, "attribute key must be a String" unless key.is_a? String
      raise ArgumentError, "attribute key cannot be empty" if key.empty?

      SDL4R.validate_identifier(namespace) unless namespace.empty?
      SDL4R.validate_identifier(key)

      attributes = @attributesByNamespace[namespace]
      
      if attributes.nil?
        attributes = {}
        @attributesByNamespace[namespace] = attributes
      end
      
      attributes[key] = SDL4R.coerce_or_fail(value)
    end
set_attribute(key, value)
   set_attribute(namespace, key, value)

 Set an attribute in the given namespace for this tag.  The allowable
 attribute value types are the same as those allowed for #add_value.

 _namespace_:: The namespace for this attribute
 _key_:: The attribute key
 _value_:: The attribute value

 Raises +ArgumentError+ if the key is not a legal SDL identifier (see
 SDL4R#validate_identifier), or the namespace is non-blank and is not a legal SDL identifier,
 or thevalue is not a legal SDL type