Example: xml-zip [skip ci]

This commit is contained in:
Michiel Borkent 2021-05-27 09:31:35 +02:00
parent 17f35b4d48
commit ec479f049a
2 changed files with 17 additions and 0 deletions

View file

@ -300,6 +300,8 @@ $ examples/which.clj rg
A script to retrieve the version from a `pom.xml` file. See
[pom_version_get.clj](pom_version_get.clj). Written by [@wilkerlucio](https://github.com/wilkerlucio).
See [pom_version_get_xml_zip.clj](pom_version_get_xml_zip.clj) for how to do the same using zippers.
Also see [pom_version_set.clj](pom_version_set.clj) to set the pom version.
## Whatsapp frequencies

View file

@ -0,0 +1,15 @@
(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {org.clojure/data.zip {:mvn/version "RELEASE"}}})
(require '[clojure.data.xml :as xml]
'[clojure.data.zip.xml :as xmlz]
'[clojure.zip :as zip])
(def xml "<pom><version>1.0.0</version></pom>")
(-> xml
xml/parse-str
zip/xml-zip
(xmlz/xml1-> :pom :version zip/down zip/node))
;; => 1.0.0