Browse Source

org-odt.el: Fix corruption due to multiple XML declarations

* lisp/org-odt.el (org-odt-init-outfile)
(org-odt-write-manifest-file): Disable
`nxml-auto-insert-xml-declaration-flag'.

* lisp/org-lparse.el (org-do-lparse): Don't trigger auto-mode
processing.

Guard against insertion of multiple XML declarations within
component XML files when
`nxml-auto-insert-xml-declaration-flag' is on.

Fixes bug
http://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00510.html.
Jambunathan K 12 years ago
parent
commit
1e811161c5
2 changed files with 5 additions and 5 deletions
  1. 0 3
      lisp/org-lparse.el
  2. 5 2
      lisp/org-odt.el

+ 0 - 3
lisp/org-lparse.el

@@ -1111,9 +1111,6 @@ version."
       (unless body-only
 	(org-lparse-end 'DOCUMENT-CONTENT))
 
-      (unless (plist-get opt-plist :buffer-will-be-killed)
-	(set-auto-mode t))
-
       (org-lparse-end 'EXPORT)
 
       ;; kill collection buffer

+ 5 - 2
lisp/org-odt.el

@@ -2211,7 +2211,9 @@ captions on export.")
 	 (content-file (expand-file-name "content.xml" outdir)))
 
     ;; init conten.xml
-    (with-current-buffer (find-file-noselect content-file t))
+    (with-current-buffer
+	(let ((nxml-auto-insert-xml-declaration-flag nil))
+	  (find-file-noselect content-file t)))
 
     ;; reset variables
     (setq org-odt-manifest-file-entries nil
@@ -2320,7 +2322,8 @@ visually."
   (make-directory "META-INF")
   (let ((manifest-file (expand-file-name "META-INF/manifest.xml")))
     (with-current-buffer
-	(find-file-noselect manifest-file t)
+	(let ((nxml-auto-insert-xml-declaration-flag nil))
+	  (find-file-noselect manifest-file t))
       (insert
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
      <manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\" manifest:version=\"1.2\">\n")