Skip to content

Commit 5ff464c

Browse files
committed
DXML-44 support empty on elements
1 parent ef89c7a commit 5ff464c

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/main/clojure/clojure/data/xml/node.cljc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@
119119
:clj
120120
[(seq [this] (iterator-seq (.iterator this)))])
121121

122+
#?(:clj (empty [_] (Element. tag {} [] {})))
123+
122124
;; j.u.Map and included interfaces
123125
#?@(:clj
124126
[Map

src/test/clojure/clojure/data/xml/test_process.clj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
(ns clojure.data.xml.test-process
22
(:require [clojure.data.xml :refer :all]
3-
[clojure.test :refer :all]))
3+
[clojure.test :refer :all]
4+
[clojure.walk :as w]
5+
[clojure.string :as str]))
46

57
(def test-data
68
(element
@@ -14,3 +16,12 @@
1416
(deftest process
1517
(is (= (find-xmlns test-data) #{"" "GEE:" "GOO:"}))
1618
(is (= (set (vals (element-nss (aggregate-xmlns test-data)))) #{"GEE:" "GOO:"})))
19+
20+
(deftest walk-test
21+
(is (= {:tag :FOO, :attrs {}, :content ()}
22+
(w/postwalk (fn [e]
23+
(println e)
24+
(if (element? e)
25+
(update e :tag (comp keyword str/upper-case name))
26+
e))
27+
(element :foo)))))

0 commit comments

Comments
 (0)