Skip to content

Commit

Permalink
DXML-30: fix emit of default namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
bendlas authored and Ryan Senior committed Aug 28, 2016
1 parent 814825f commit e84990d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/clojure/clojure/data/xml/jvm/emit.clj
Expand Up @@ -75,7 +75,7 @@
(persistent!
(reduce (fn [tleft uri]
(if (and (not (str/blank? uri))
(str/blank? (get-prefix writer tleft uri)))
(nil? (get-prefix writer tleft uri)))
(assoc! tleft uri (make-prefix (.getNamespaceContext writer)))
tleft))
tleft used-uris))))
Expand Down
5 changes: 5 additions & 0 deletions src/test/clojure/clojure/data/xml/test_emit.clj
Expand Up @@ -184,3 +184,8 @@
(element (to-qname "{NS2}foo"))
(element (to-qname "{NS2}bar")))]
(is (= (parse-str (emit-str el)) el))))

(deftest test-default-xmlns
(is (= {:clojure.data.xml/nss {:xmlns "NS"}}
(meta (parse-str "<foo xmlns=\"NS\"/>"))
(meta (parse-str (emit-str (parse-str "<foo xmlns=\"NS\"/>")))))))

0 comments on commit e84990d

Please sign in to comment.