I will not expect HTML to be necessarily split into lines in a reasonable way; without looking beyond our own backyard, for example. Compojure (or Hiccup at the moment, I think) doesn't bother inserting line breaks, I believe (update: just tested Hiccup - no line breaks).
Instead, I would suggest lazy XML parsing (with clojure.contrib.lazy-xml ) on top of java.io.BufferedInputStream .
source share