emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Opening an odt file - problem solved
@ 2012-05-19 10:17 itmejl
  2012-05-19 12:06 ` Achim Gratz
  2012-05-20  9:56 ` Jambunathan K
  0 siblings, 2 replies; 9+ messages in thread
From: itmejl @ 2012-05-19 10:17 UTC (permalink / raw)
  To: eol

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello!

Sharing a solution to a problem I had myself with opening an odt file
after export. I use emacs 23.4 on win7 with orgmode 7.8.03.

I could not open the new exported odt file with word2010 or
libreoffice. Somewhere I found out that content.xml that is inside the
odt file was the faulty part.

Parts of odt file

M Filemode      Length  Date         Time      File
- - ----------  --------  -----------  --------  ---------------------
  -rw-rw-rw-        39  19-May-2012  11:35:06  mimetype
  -rw-rw-rw-     40104  19-May-2012  11:35:06  content.xml
  drwxrwxrwx         0  19-May-2012  11:35:06  Images/
  -rw-rw-rw-      1132  19-May-2012  11:35:04  Images/0001.png
  -rw-rw-rw-      1132  19-May-2012  11:35:06  Images/0002.png
  -rw-rw-rw-      1132  19-May-2012  11:35:06  Images/0003.png
  drwxrwxrwx         0  19-May-2012  11:35:06  meta-inf/
  -rw-rw-rw-       966  19-May-2012  11:35:06  META-INF/manifest.xml
  -rw-rw-rw-       846  19-May-2012  11:35:06  meta.xml
  -rw-rw-rw-     61814  19-May-2012  11:35:06  styles.xml
- - ----------  --------  -----------  --------  ---------------------
                107165                         10 files


The top of content.xml looked like this:

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content .....

Three xml declarations!

Checked my settings in .emacs and found that I had an nxml property
set like this:
'(nxml-auto-insert-xml-declaration-flag t)

After changed it to
'(nxml-auto-insert-xml-declaration-flag nil)
, restarting emacs and exporting to odt again I could open the odt file.


The top of content.xml inside the odt file now looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<office:document-content.....

Just one declaration.

So if want to be able to open odt files created with orgmode odt
exporter you have to have nxml-auto-insert-xml-declaration-flag set to
nil.


/Christina
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iEYEARECAAYFAk+3czwACgkQ2+bVj21Y+8lvqACfc3i1QJH8BE9Ykthjb94Kaspe
/YwAoJUDvlVbiZbqenV/HIl8omdgDAvC
=1idV
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Opening an odt file - problem solved
  2012-05-19 10:17 Opening an odt file - problem solved itmejl
@ 2012-05-19 12:06 ` Achim Gratz
  2012-05-20  9:56 ` Jambunathan K
  1 sibling, 0 replies; 9+ messages in thread
From: Achim Gratz @ 2012-05-19 12:06 UTC (permalink / raw)
  To: emacs-orgmode

itmejl@chrikro.net writes:
> After changed it to
> '(nxml-auto-insert-xml-declaration-flag nil)

Good catch.  It would be preferable if that variable was let-bound to
nil in the export functions that write out the templates so that users
can set it to whatever they want in their configuration.

Jambunathan, are you listening?


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Opening an odt file - problem solved
  2012-05-19 10:17 Opening an odt file - problem solved itmejl
  2012-05-19 12:06 ` Achim Gratz
@ 2012-05-20  9:56 ` Jambunathan K
  2012-05-24  9:36   ` Bastien
  1 sibling, 1 reply; 9+ messages in thread
From: Jambunathan K @ 2012-05-20  9:56 UTC (permalink / raw)
  To: itmejl@chrikro.net; +Cc: eol


> So if want to be able to open odt files created with orgmode odt
> exporter you have to have nxml-auto-insert-xml-declaration-flag set to
> nil.

Thanks for writing this down.  It seems you aren't insisting on a fix.
So I will keep things as they are now.
-- 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Opening an odt file - problem solved
  2012-05-20  9:56 ` Jambunathan K
@ 2012-05-24  9:36   ` Bastien
  2012-05-24 16:24     ` Jambunathan K
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2012-05-24  9:36 UTC (permalink / raw)
  To: Jambunathan K; +Cc: eol, itmejl@chrikro.net

Hi Jambunathan,

Jambunathan K <kjambunathan@gmail.com> writes:

>> So if want to be able to open odt files created with orgmode odt
>> exporter you have to have nxml-auto-insert-xml-declaration-flag set to
>> nil.
>
> Thanks for writing this down.  It seems you aren't insisting on a fix.

I think the fix would be nice to have.

Can you fix it?

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Opening an odt file - problem solved
  2012-05-24  9:36   ` Bastien
@ 2012-05-24 16:24     ` Jambunathan K
  2012-05-24 16:28       ` Bastien
  2012-05-24 16:30       ` Jambunathan K
  0 siblings, 2 replies; 9+ messages in thread
From: Jambunathan K @ 2012-05-24 16:24 UTC (permalink / raw)
  To: Bastien; +Cc: eol, itmejl@chrikro.net

Bastien <bzg@gnu.org> writes:

> Hi Jambunathan,
>
> Jambunathan K <kjambunathan@gmail.com> writes:
>
>>> So if want to be able to open odt files created with orgmode odt
>>> exporter you have to have nxml-auto-insert-xml-declaration-flag set to
>>> nil.
>>
>> Thanks for writing this down.  It seems you aren't insisting on a fix.
>
> I think the fix would be nice to have.
>
> Can you fix it?

OK.  Fixed in both maint and master.  The exported ODT file will not
have multiple XML declrations.

I see that there is a bug in nxml-mode.  I file a bug report against
Emacs sometime soon.  The bug is:

When `nxml-auto-insert-xml-declaration-flag' is on, if one opens a ODT
file in archive mode and presses RET on say content.xml, an "extra" XML
declaration is added.  (i.e., Emacs tampers with XML file) This
shouldn't happen.

> Thanks,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Opening an odt file - problem solved
  2012-05-24 16:24     ` Jambunathan K
@ 2012-05-24 16:28       ` Bastien
  2012-05-25 13:57         ` Jambunathan K
  2012-05-24 16:30       ` Jambunathan K
  1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2012-05-24 16:28 UTC (permalink / raw)
  To: Jambunathan K; +Cc: eol, itmejl@chrikro.net

Jambunathan K <kjambunathan@gmail.com> writes:

>> Can you fix it?
>
> OK.  Fixed in both maint and master.  The exported ODT file will not
> have multiple XML declrations.

Great, thanks a lot!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Opening an odt file - problem solved
  2012-05-24 16:24     ` Jambunathan K
  2012-05-24 16:28       ` Bastien
@ 2012-05-24 16:30       ` Jambunathan K
  1 sibling, 0 replies; 9+ messages in thread
From: Jambunathan K @ 2012-05-24 16:30 UTC (permalink / raw)
  To: itmejl@chrikro.net; +Cc: eol

Jambunathan K <kjambunathan@gmail.com> writes:

> I see that there is a bug in nxml-mode.  I file a bug report against
> Emacs sometime soon.  The bug is:
>
> When `nxml-auto-insert-xml-declaration-flag' is on, if one opens a ODT
> file in archive mode and presses RET on say content.xml, an "extra" XML
> declaration is added.  (i.e., Emacs tampers with XML file) This
> shouldn't happen.

So to verify the fix:

1. Unzip ODT file in a shell and then 
2. Do M-x find-file-literally RET content.xml RET
3. Verify that none of the XML files have multiple XML declarations.

-- 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Opening an odt file - problem solved
  2012-05-24 16:28       ` Bastien
@ 2012-05-25 13:57         ` Jambunathan K
  2012-05-25 21:17           ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Jambunathan K @ 2012-05-25 13:57 UTC (permalink / raw)
  To: Bastien; +Cc: eol, itmejl@chrikro.net

Bastien <bzg@gnu.org> writes:

> Jambunathan K <kjambunathan@gmail.com> writes:
>
>>> Can you fix it?
>>
>> OK.  Fixed in both maint and master.  The exported ODT file will not
>> have multiple XML declrations.
>
> Great, thanks a lot!

This fix is back-firing.  I have pushed an updated fix.

I ignored the following warning
    Warning: defvar ignored because
    nxml-auto-insert-xml-declaration-flag is let-bound

which leads to the following error while creating a new xml file
    File mode specification error: (void-variable
    nxml-auto-insert-xml-declaration-flag)

To workaround above issue (i.e., if this fix is not applied for whatever
reasons), make sure you do
    M-x load-library RET nxml-mode RET before
starting a ODT export

or add a
    (require 'nxml-mode)

to your init file.

Note:: nxml-mode is not really needed for ODT export to go through
[1]. I will remove this dependency for the new exporter (org-e-odt.el)
but retain it for the current exporter (org-odt.el) [2].

Footnotes:

[1] nxml-mode is triggered because of the auto-mode activities on XML
buffer.  The mode chosen by auto-mode would depend upon user
configuration and it is not guaranteed to be nxml-mode in all cases.

[2] I don't want to distrub the stability of org-odt.el in Emacs-24.1
due to last minute changes.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Opening an odt file - problem solved
  2012-05-25 13:57         ` Jambunathan K
@ 2012-05-25 21:17           ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2012-05-25 21:17 UTC (permalink / raw)
  To: Jambunathan K; +Cc: eol, itmejl@chrikro.net

Hi Jambunathan,

Jambunathan K <kjambunathan@gmail.com> writes:

> This fix is back-firing.  I have pushed an updated fix.

Fixed in Org 7.8.11 and Emacs 24.1 branches.

> Note:: nxml-mode is not really needed for ODT export to go through
> [1]. I will remove this dependency for the new exporter (org-e-odt.el)
> but retain it for the current exporter (org-odt.el) [2].

That's good news, thanks.

> [2] I don't want to distrub the stability of org-odt.el in Emacs-24.1
> due to last minute changes.

It was about to happen because Emacs RC will be released this week-end
and I thought I would not have any internet connection between today
noon and tuesday.  But that's okay.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-05-25 23:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-19 10:17 Opening an odt file - problem solved itmejl
2012-05-19 12:06 ` Achim Gratz
2012-05-20  9:56 ` Jambunathan K
2012-05-24  9:36   ` Bastien
2012-05-24 16:24     ` Jambunathan K
2012-05-24 16:28       ` Bastien
2012-05-25 13:57         ` Jambunathan K
2012-05-25 21:17           ` Bastien
2012-05-24 16:30       ` Jambunathan K

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).