Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make xml-> return empty strings instead of skipping non-matching nodes
(ns test
(:require [clojure.zip :as zip]
[clojure.data.xml :as xml]
[clojure.data.zip.xml :as zx]))
(def xml-example
"<top>
<id>
<desc>
<other>Something</other>
<desc>A description</desc>
</desc>
</id>
<id>
<desc>
<desc>Another description</desc>
</desc>
</id>
</top>")
(zx/xml-> (zip/xml-zip (xml/parse-str xml-example))
:top :id :desc :other zx/text)
;; Returns ("Something") while I would like ("Something" "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.