Last active
April 13, 2017 07:17
-
-
Save bzg/a35c4f986583e490480b5932d601ffed to your computer and use it in GitHub Desktop.
Make xml-> return empty strings instead of skipping non-matching nodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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