title: How to elegantly parse xml in clojure
body: <p>I have this piece of code building up sentences from XML looking like follows. I wonder what might be an alternative code, that would be more readable after being hacked to work.</p>
  
  <pre><code>     (mapcat
          (fn [el]
             (map special-join
                (map
                    (fn [el] (map zip-xml/text (zip-xml/xml-&gt; el :word)))
                    (zip-xml/xml-&gt; el :sentence))))
          (zip-xml/xml-&gt; root :document))
  </code></pre>
  
  <p>The above code is not very readable, given the repeat inline function definitions combined with the nested probing, but tearing them apart into standalone functions as in <a href="https://github.com/clojuredocs/guides/blob/master/articles/tutorials/parsing_xml_with_zippers.md" rel="nofollow noreferrer">this official tutorial</a> really doesn't make sense to me for such simple cases.</p>
  
  <p>For completeness, here's the repeat XML structure that this is parsing </p>
  
  <pre><code>&lt;document&gt;
    &lt;sentence id="1"&gt;
      &lt;word id="1.1"&gt;Foo&lt;/w&gt;
      &lt;word id="1.2"&gt;bar&lt;/w&gt;
    &lt;/sentence&gt;
  &lt;/document&gt;
  </code></pre>