According to the README of data.xml, the data structure returned by parse contains lazy sequences. So the XML tree returned by
(with-open [r (io/input-stream (io/file "data.xml"))]
(xml/parse r))
may throw an exception when traversing the tree outside this code block, because the input-stream has been already closed.
What is the most elegant way to force evaluation of the whole tree before returning? I tried the following but I am wondering if there is anything simpler.
(with-open [r (io/input-stream (io/file "data.xml"))]
(doto (xml/parse r)
(->> (tree-seq map? :content) (dorun))))