+(defun nnrss-opml-import (opml-file)
+ "OPML subscriptions import.
+Read the file and attempt to subscribe to each Feed in the file."
+ (interactive "fImport file: ")
+ (mapcar
+ (lambda (node) (gnus-group-make-rss-group
+ (cdr (assq 'xmlUrl (cadr node)))))
+ (nnrss-find-el 'outline
+ (progn
+ (find-file opml-file)
+ (xml-parse-region (point-min)
+ (point-max))))))
+
+(defun nnrss-opml-export ()
+ "OPML subscription export.
+Export subscriptions to a buffer in OPML Format."
+ (interactive)
+ (with-current-buffer (get-buffer-create "*OPML Export*")
+ (mm-set-buffer-file-coding-system 'utf-8)
+ (insert (concat
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ "<!-- OPML generated by Emacs Gnus' nnrss.el -->\n"
+ "<opml version=\"1.1\">\n"
+ " <head>\n"
+ " <title>mySubscriptions</title>\n"
+ " <dateCreated>" (format-time-string "%a, %d %b %Y %T %z")
+ "</dateCreated>\n"
+ " <ownerEmail>" user-mail-address "</ownerEmail>\n"
+ " <ownerName>" (user-full-name) "</ownerName>\n"
+ " </head>\n"
+ " <body>\n"))
+ (mapc (lambda (sub)
+ (insert (concat
+ " <outline text=\"" (car sub) "\" xmlUrl=\""
+ (cadr sub) "\"/>\n")))
+ nnrss-group-alist)
+ (insert (concat
+ " </body>\n"
+ "</opml>\n")))
+ (pop-to-buffer "*OPML Export*")
+ (when (fboundp 'sgml-mode)
+ (sgml-mode)))
+