export (Raggle::OPML)

    # File raggle, line 1198
        def OPML::export(file_name)
          begin
            opml = REXML::Element.new("opml")
            opml.attributes['version'] = '1.1'

            opml.add_element(opml_head)

            body = REXML::Element.new('body')
            opml.add_element(body)
            $config['feeds'].each do |feed|
              body.add_element(feed_to_outline(feed))
            end

            doc = REXML::Document.new
            doc << REXML::XMLDecl.new
            doc.add(opml)

            file = (file_name == '-') ? $stdout : File::open(file_name, 'w')
            if file
              begin
                doc.write(file, 0)
                Interfaces::NcursesInterface::set_status($config['msg_opml_exported']) if $wins
              ensure
                file.close unless file_name == '-'
              end
            else
              raise "Couldn't open output file \"#{file_name}\"."
            end
          rescue => err
            if $wins: Interfaces::NcursesInterface::set_status($config['msg_bad_uri'])
            else die err.message; end
          end
        end