Permalink
Browse files

DZIP-3 doesnt match on first node

Signed-off-by: puredanger <alex.miller@cognitect.com>
  • Loading branch information...
slipset authored and puredanger committed Apr 27, 2016
1 parent c221dec commit c5d6ca25c128f9fe937b11505c7c9736cfa2dd9a
Showing with 11 additions and 4 deletions.
  1. +3 −4 src/main/clojure/clojure/data/zip/xml.clj
  2. +8 −0 src/test/clojure/clojure/data/zip/xml_test.clj
@@ -28,10 +28,9 @@
named tagname."
[tagname]
(fn [loc]
(filter #(and (zip/branch? %) (= tagname (:tag (zip/node %))))
(if (zf/auto? loc)
(zf/children-auto loc)
(list (zf/auto true loc))))))
(or (= tagname (:tag (zip/node loc)))
(filter #(and (zip/branch? %) (= tagname (:tag (zip/node %))))
(zf/children-auto loc)))))
(defn text
"Returns the textual contents of the given location, similar to
@@ -90,3 +90,11 @@
(is (= (xml-> record :entry :author text)
'("John" "Jane"))))
(def atom2 (parse-str "<feed>
<foo>bar</foo></feed>"))
(deftest dzip-3-first-node
(is (not= (xml-> atom2 :feed ) '())))
(deftest dzip-3-second-node
(is (= (xml-> atom2 :foo text) '("bar"))))

0 comments on commit c5d6ca2

Please sign in to comment.