Does inserting clojure.zip/down between the two :thing's help?
If these examples are representative, then clojure.core/xml-seq could be
simpler than zippers:
(def xmlstuff (first example1)) ;; you got a list from parse; get the root
element
(->> xmlstuff xml-seq (filter #(= :thing (:tag %))) (mapcat :content)
(filter string?))
;; ("Want this" "Select this")
Other techniques to consider:
- If capable selectors are important, consider Enlive. It, too, starts
with what you get from clojure.xml/parse, and it, too, uses zippers inside.
- If you like zippers, with a plain old loop you may use clojure.zip/next
to traverse the tree and harvest the text nodes you need. You could even
look only at text nodes, and query the zipper for their parent...
- If you like zippers and xml->, the functions you can use in an xml-> path
are not a closed set -- you may make a function that does what you want.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.