;; This example shows the use of the ':encoding' option.
(require '(clojure.data.xml :as xml))
(let [tags (xml/element :foo {:foo-attr "foo value"}
(xml/element :bar {:bar-attr "bar value"}
(xml/element :baz {} "The baz value")))]
(with-open [out-file (clojure.java.io/writer "/temp/bar.xml" :encoding "UTF-8")]
(xml/emit tags out-file))
(with-open [input (clojure.java.io/reader "/temp/bar.xml")]
(xml/parse input)))
;;=> #clojure.data.xml.Element{:tag :foo, :attrs {:foo-attr "foo value"},
;; :content
;; (#clojure.data.xml.Element{:tag :bar, :attrs {:bar-attr "bar value"},
;; :content
;; (#clojure.data.xml.Element{:tag :baz, :attrs {}, :content ("The baz value")})})}