Hello!
What's the clever way to read the E-tags "thisone" and "andthis" in the
XML-file below given I don't know their id on beforehand?
<a>
<b>bla bla</b>
<b>bla bla</b>
<c id="wanted">
<d id="1">
<e id="notthisone"/></d>
<d id="2">
<e id="thisone"/>
<e id="andthis"/></d>
<d id="3">
<e id="not-intresting"></d>
</a>
My solution so far would be something like
(def mz (zip/xml-zip (xml/parse "dataabove.xml")))
(defn get-all-dimensions []
(filter #(and (= "2" (:id %)) (= :e (:tag %))) (zip/children mz))))
but I'm looking for some descending solution
(-> mz
(zip/down a)
(zip/down c :where (= :id "wanted"))
(zip/down d :where (= :id 2))
zip/children)
(an xpath-like solution would most awesome)
According to it's own page Enlive is not very good for xml and I cannot
figure out the way to dynamically walk with zippers (like "go into the tag
:d with id=..."). Would Enlive work for my needs here?
When I got this sorted out I will try my best to add some examples on
clojuredocs.org, zippers is good but I don't know if it's for everything.
/Linus
--
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