I'm finding the usage of xml-> extremely confusing. I've read the docs and the examples but can't figure out how to get the nested nodes of an xml doc.
Assume the following xml is in a zipper (as from xml-zip):
<html>
<body>
<div class='one'>
<div class='two'></div>
</div>
</body>
</html>
I am trying to return the div with class='two'.
I was expecting this to work:
(xml-> z :html :body :div :div)
Or this:
(xml-> z :html :body :div (attr= :class "two"))
Kind of like css selectors.
But it returns only the first level, and it doesn't search down through the tree.
The only way I can make it work is:
(xml-> z :html :body :div children leftmost?)
Is that what I'm supposed to do?
The whole reason I started using xml-> was for convenience and to avoid navigating the zipper up and down and left and right. If xml-> can not get nested nodes then I don't see the value over clojure.zip.
Thanks.