data.zip: add clojure.zip/xml-zip; clojure.xml lives in jolt-lang/xml
clojure.zip was missing xml-zip — a zipper over xml {:tag :content} elements,
which clojure.data.zip and any xml-zipper code needs. Added (runtime, loaded on
require). clojure.data.zip's whole xml suite (9/9) then passes, once XML parsing
is provided: clojure.xml/parse now ships in jolt-lang/xml over its
javax.xml.stream pull parser (committed there).
Listed in docs/libraries.md + the site.
This commit is contained in:
parent
a83ff6ce40
commit
745d22260f
2 changed files with 13 additions and 0 deletions
|
|
@ -28,6 +28,16 @@
|
|||
[root]
|
||||
(zipper vector? seq (fn [node children] (with-meta (vec children) (meta node))) root))
|
||||
|
||||
(defn xml-zip
|
||||
"Returns a zipper for xml elements (as from clojure.xml/parse), given a root
|
||||
element"
|
||||
[root]
|
||||
(zipper (complement string?)
|
||||
(comp seq :content)
|
||||
(fn [node children]
|
||||
(assoc node :content (and children (apply vector children))))
|
||||
root))
|
||||
|
||||
(defn node "Returns the node at loc" [loc] (nth loc 0))
|
||||
|
||||
(defn branch? "Returns true if the node at loc is a branch"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue