chickadee » atom » make-atom-doc

make-atom-doc root #!key (declare-xml? #t) (encoding utf-8) (headers '())procedure

Create an Atom Feed Document or Atom Entry Document. ROOT is the atom:feed or atom:entry SXML root node, usually created by make-feed or make-entry. Returns a SXML document representing the entire Atom document, which can be written out using write-atom-doc.

Whether to add an XML declaration to the document, as a boolean value.
The encoding to declare in the (optional) XML declaration, as a string.
A list of headers to include in the output document; see below.

Arbitrary headers may be added to the output document. These headers should, generally, be XML processing instructions or comments, since the document must consist of only one root node. For example, you can prepend some stylesheet instructions:

 (make-atom-doc feed
  headers: '((*PI* xml-stylesheet
              "type=\"text/xsl\" href=\"\"")
             (*PI* xml-stylesheet
              "type=\"text/css\" href=\"\"")))

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href=""?>
<?xml-stylesheet type="text/css" href=""?>
<atom:feed xmlns:atom="">

Since this procedure just returns a complete SXML document beginning with a *TOP* node, you could instead modify the returned document and add any processing instructions yourself. headers is just a convenient way of doing so.