# File lib/soap/element.rb, line 168
  def encode(generator, ns, attrs = {})
    attrs.each do |key, value|
      @element.extraattr[key] = value
    end
    # to remove mustUnderstand attribute, set it to nil
    unless @mustunderstand.nil?
      @element.extraattr[AttrMustUnderstandName] = (@mustunderstand ? '1' : '0')
    end
    if @encodingstyle
      @element.extraattr[AttrEncodingStyleName] = @encodingstyle
    end
    unless @element.encodingstyle
      @element.encodingstyle = @encodingstyle
    end
    if @actor
      @element.extraattr[AttrActorName] = @actor
    end
    yield(@element)
  end