# File jabber4r/protocol.rb, line 950

      def to_xml(format, indent=0)

        result = ""

        result += " "*indent if format

        result += "<#{@tag}"

        @attributes.each {|attrib, value| result += (' '+attrib.to_s+'="'+value.to_s+'"') }

        if @data=="" and @elements.size==0

          result +="/>"

          result +="\n" if format

          return result

        end

        result += ">"

        result += "\n" if format and @data==""

        result += @data if @data!=""

        @elements.each {|element| result+=element.to_xml(format, indent+4)}

        result += @xml if not @xml.nil?

        result += " "*indent if format and @data==""

        result+="</#{@tag}>"

        result+="\n" if format

        return result

      end