how can i generate xml without namespace using orgclojure dataxml?

I think you can get what you want like this using uri aliases:

(require '[clojure.data.xml :as xml])

;; declare a uri alias in this namespace
(xml/alias-uri 'atom "http://www.w3.org/2005/Atom")

;; use the alias as tag prefix, but also declare at the root as default
(xml/emit-str 
  (xml/sexp-as-element 
    [::atom/feed {:xmlns "http://www.w3.org/2005/Atom"}]))

;; emitted string:
;; "<?xml version=\"1.0\" encoding=\"UTF-8\"?><feed xmlns=\"http://www.w3.org/2005/Atom\"/>"

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top