prxml(clojure.contrib.prxml)

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 &amp; 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"?>

; clojure/contrib/prxml.clj:142
(defn prxml
  [& args]
  (doseq [arg args] (print-xml arg)))

Copyright (c) Rich Hickey. All rights reserved.

The use and distribution terms for this software are covered by the Eclipse Public License 1.0, which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.