    (let [updated (with-open [r (io/reader manifest)]
                   (update-meta-data (xml/parse r :support-dtd false)
                                     production handle-manifest-node))]
-    (with-open [w (io/writer manifest)]
-      (xml-new/emit updated w :doctype manifest-doctype)))))
+     (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

  [xml production handler]
  (w/postwalk #(handler % production) xml))

(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

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

(defn update-meta-data!
  "Update the manifest and the smil file of a `volume` for
