RSS Feed

Lisp Project of the Day


You can support this project by donating at:

Donate using PatreonDonate using Liberapay

Or see the list of project sponsors.


Tests ๐Ÿคจ
CI ๐Ÿ˜€

This library can be used to generate XML. You can use it for outputting any XML, but I use its builtin helpers to generate RSS feed.

Here is how to generate RSS feed in Common Lisp:

POFTHEDAY> (with-output-to-string (s)
             (xml-emitter:with-rss2 (s :encoding "utf-8")
               (xml-emitter:rss-channel-header "Common Lisp Project of the Day" 
               (xml-emitter:rss-item "First post"
                                     :description "Hello World"
                                     :category "lisp")))

"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<rss version=\"2.0\">
        <title>Common Lisp Project of the Day</title>
            <title>First post</title>
            <description>Hello World</description>

Of cause, you easily can generate any XML as well:

POFTHEDAY> (with-output-to-string (s)
             (xml-emitter:with-xml-output (s)
               (xml-emitter:with-tag ("address-book")
                 (xml-emitter:with-tag ("contact")
                    :name "Bob"
                    :email ""
                    :note "My friend."))
                 (xml-emitter:with-tag ("contact")
                    :name "Mary"
                    :twitter "")))))

"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
        <note>My friend.</note>

Please, note that support for XML namespaces is very limited. You can only specify a namespace for some tags. Namespace prefixes are not supported.

Brought to you by 40Ants under Creative Commons License