API for prxml
- ()
by Stuart Sierra
clojure-contrib is now deprecated
clojure-contrib is no longer being developed or maintained.
Rather than a single, monolithic, contributions library, Clojure now has
a set of separate libraries for each unit of functionality. The libraries
are in the Clojure GitHub organization at
https://github.com/clojure.
API documentation of the libraries can be found at
https://clojure.github.io.
If you're looking for a specific function or namespace from the old
clojure-contrib, see
"Where Did Clojure.Contrib Go".
Full namespace name:
clojure.contrib.prxml
Overview
Compact syntax for generating XML. See the documentation of "prxml"
for details.
Public Variables and Functions
*html-compatible*
var
This library, clojure-contrib, is deprecated. See here for more information.
If true, empty tags will have a space before the closing />
Source
*prxml-indent*
var
This library, clojure-contrib, is deprecated. See here for more information.
The number of spaces to indent sub-tags. nil for no indent
and no extra line-breaks.
Source
prxml
function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (prxml & args)
Print XML to *out*. Vectors become XML tags: the first item is the
tag name; optional second item is a map of attributes.
Sequences are processed recursively, so you can use map and other
sequence functions inside prxml.
(prxml [:p {:class "greet"} [:i "Ladies & gentlemen"]])
; => <p class="greet"><i>Ladies & gentlemen</i></p>
PSEUDO-TAGS: some keywords have special meaning:
:raw! do not XML-escape contents
:comment! create an XML comment
:decl! create an XML declaration, with attributes
:cdata! create a CDATA section
:doctype! create a DOCTYPE!
(prxml [:p [:raw! "<i>here & gone</i>"]])
; => <p><i>here & gone</i></p>
(prxml [:decl! {:version "1.1"}])
; => <?xml version="1.1" encoding="UTF-8"?>
Source