Fork me on GitHub
#slack-help
<
2017-03-17
>
lens09:03:45

Hi guys! Need help. I got XML structure by clojure.data.xml from some response. How can i shortly get deep elements, without trying something like

(->myxml
    :content
    :tag :sometag
   :content
...and so on

jumar11:03:50

@lens you'd be better off asking in another channel. However, this article can be useful: http://blog.korny.info/2014/03/08/xml-for-fun-and-profit.html

jumar11:03:25

I've never used that before, but it can look like this:

(clojure.data.zip.xml/xml-> (clojure.zip/xml-zip (clojure.data.xml/parse-str "<parent><child><names><firstname>Juraj</firstname></names></child></parent>"))
                            :parent
                            :child
                            :names
                            :firstname
                            clojure.data.zip.xml/text)

lens11:03:50

yeah, thanks, i got help from another channel, and got the same link 🙂, which was very usefull, that solve my problem and make my day.

korny11:03:21

Glad my old blog post is still useful :-)

lens12:03:17

i'm a beginner and your blog let me know a lot about zippers ))), thanks!

us3r6422:03:06

@clojurebot IDE

seancorfield22:03:00

@us3r64 ClojureBot’s role here is to evaluate Clojure code. You do that via the /clj command...

seancorfield22:03:33

/clj (clojure-version) produced that.

us3r6422:03:05

i tried to be funny there, i was not expecting an output from it