Skip to content

Instantly share code, notes, and snippets.

@rotaliator
Created September 13, 2021 12:01
Show Gist options
  • Save rotaliator/cf1a3859298bcdba3c68b22f688c323c to your computer and use it in GitHub Desktop.
Save rotaliator/cf1a3859298bcdba3c68b22f688c323c to your computer and use it in GitHub Desktop.
(defn xml->map
"Konwertuje sparsowanego xml'a na mapę.
Uwaga, uwzględnia tylko tagi i zawartość. Ignoruje atrybuty"
[xml]
(walk/postwalk
(fn [e]
(let [content (:content e)]
(cond
(map? e) {(:tag e)
(if (<= (count content) 1)
(first content)
content)}
:else e)))
xml))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment