   [xml production handler]
   (w/postwalk #(handler % production) xml))
 
+(defn xml-format!
+  "Format xml file `in` and store it in file `out`"
+  [in out]
+  (shell/sh "xmllint" "--format" "--nonet"
+            "--output" (.getAbsolutePath out)
+            (.getAbsolutePath in)))
+
 (defn update-mainfest!
   "Update the manifest file of `volume` for `production` in-place with
   the meta data from `production`. If a `manifest` is given the

  Book](http://www.daisy.org/daisypedia/daisy-digital-talking-book)"
  (:require [clojure.java.io :as io]
            [clojure.data.xml :as xml]
            [mdr2.data.xml :as xml-new]
            [clojure.walk :as w]
            [clojure.zip :as zip]

   (let [updated (with-open [r (io/reader manifest)]
                  (update-meta-data (xml/parse r :support-dtd false)
                                    production handle-manifest-node))]
     (let [tmp-file (java.io.File/createTempFile "mdr2-" ".xml")]
       (with-open [w (io/writer tmp-file)]
         (xml-new/emit updated w :doctype manifest-doctype))
       (xml-format! tmp-file manifest)
       (.delete tmp-file)))))

(defn update-master-smil!
  "Update the master smil file of `volume` for `production` in-place
