emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* DTD prohibited
@ 2014-06-02 10:40 AW
  2014-06-02 11:33 ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: AW @ 2014-06-02 10:40 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I'm drafting documents with orgmode. Once in a while I have to export them to 
html and send them as an attachment to an email, telling the recipient to open 
the file with word.

Now, Word no longer can open the html-documents produced by orgmode. The error 
message is (translated from German): "DTD prohibited".

I tried on two PC, both times Word 2010, same result: error.

Example of orgmode-file to be exported:


* Export
Bla bla bla


Exporting to odt and opening with libre writer: no problem.

If anybody got the same error and knows a solution, I' be thankfull,

regards,

Alexander

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

* Re: DTD prohibited
  2014-06-02 10:40 DTD prohibited AW
@ 2014-06-02 11:33 ` Bastien
  2014-06-03  0:34   ` James Harkins
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2014-06-02 11:33 UTC (permalink / raw)
  To: AW; +Cc: emacs-orgmode

Hi Alexander,

AW <alexander.willand@t-online.de> writes:

> Now, Word no longer can open the html-documents produced by orgmode. The error 
> message is (translated from German): "DTD prohibited".

You may want to customize `org-html-doctype' but you probably need to
digg further to know what DTD is prohibited exactly.

HTH,

-- 
 Bastien

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

* Re: DTD prohibited
  2014-06-02 11:33 ` Bastien
@ 2014-06-03  0:34   ` James Harkins
  2014-06-03 20:14     ` AW
  0 siblings, 1 reply; 8+ messages in thread
From: James Harkins @ 2014-06-03  0:34 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg <at> gnu.org> writes:

> 
> Hi Alexander,
> 
> AW <alexander.willand <at> t-online.de> writes:
> 
> > Now, Word no longer can open the html-documents produced by orgmode. The 
error 
> > message is (translated from German): "DTD prohibited".
> 
> You may want to customize `org-html-doctype' but you probably need to
> digg further to know what DTD is prohibited exactly.

Apparently, all of them:

http://en.m.wikipedia.org/wiki/Document_Type_Definition

Under "Security":

~~
An XML DTD can be used to create a denial of service (DoS) attack by defining 
nested entities that expand exponentially, or by sending the XML parser to an 
external resource that never returns.[10]

For this reason, .NET Framework provides a property that allows prohibiting or 
skipping DTD parsing, [10] and recent versions of Microsoft Office 
applications (Microsoft Office 2010 and higher) refuse to open XML files that 
contain DTD declarations.
~~

So, if org ODT export now depends on a DTD, then we'd have to say that we 
don't support exported files that open in MS Word.

hjh

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

* Re: DTD prohibited
  2014-06-03  0:34   ` James Harkins
@ 2014-06-03 20:14     ` AW
  2014-06-04  7:39       ` Eric S Fraga
  0 siblings, 1 reply; 8+ messages in thread
From: AW @ 2014-06-03 20:14 UTC (permalink / raw)
  To: emacs-orgmode

Am Dienstag, 3. Juni 2014, 00:34:58 schrieb James Harkins:
> Bastien <bzg <at> gnu.org> writes:
> > Hi Alexander,
> > 
> > AW <alexander.willand <at> t-online.de> writes:
> > > Now, Word no longer can open the html-documents produced by orgmode. The
> 
> error
> 
> > > message is (translated from German): "DTD prohibited".
> > 
> > You may want to customize `org-html-doctype' but you probably need to
> > digg further to know what DTD is prohibited exactly.
> 
> Apparently, all of them:
> 
> http://en.m.wikipedia.org/wiki/Document_Type_Definition
> 
> Under "Security":
> 
> ~~
> An XML DTD can be used to create a denial of service (DoS) attack by
> defining nested entities that expand exponentially, or by sending the XML
> parser to an external resource that never returns.[10]
> 
> For this reason, .NET Framework provides a property that allows prohibiting
> or skipping DTD parsing, [10] and recent versions of Microsoft Office
> applications (Microsoft Office 2010 and higher) refuse to open XML files
> that contain DTD declarations.
> ~~
> 
> So, if org ODT export now depends on a DTD, then we'd have to say that we
> don't support exported files that open in MS Word.
> 
> hjh


Hi, 

thank you, I started again digging into this strange thing and the culprit 
seems the first line of the html-file:

<?xml version="1.0" encoding="utf-8"?>

If I remove this line, no error.  And removing simply 

xml version="1.0" 

helped as well. Courious. Because of such behaviour I hate Word, but ...

Source: http://stackoverflow.com/a/15816168

Regards,

Alexander

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

* Re: DTD prohibited
  2014-06-03 20:14     ` AW
@ 2014-06-04  7:39       ` Eric S Fraga
  2014-06-04  9:04         ` Eric Abrahamsen
  0 siblings, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2014-06-04  7:39 UTC (permalink / raw)
  To: AW; +Cc: emacs-orgmode

On Tuesday,  3 Jun 2014 at 22:14, AW wrote:

[...]

> Hi, 
>
> thank you, I started again digging into this strange thing and the culprit 
> seems the first line of the html-file:
>
> <?xml version="1.0" encoding="utf-8"?>
>
> If I remove this line, no error.  And removing simply 

Have a look at 

,----[ C-h v org-html-xml-declaration RET ]
| org-html-xml-declaration is a variable defined in `ox-html.el'.
| Its value is
| (("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
|  ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
| 
| 
| Documentation:
| The extension for exported HTML files.
| %s will be replaced with the charset of the exported file.
| This may be a string, or an alist with export extensions
| and corresponding declarations.
| 
| This declaration only applies when exporting to XHTML.
| 
| You can customize this variable.
| 
| [back]
`----
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.1, Org release_8.2.6-1133-ga5c863

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

* Re: DTD prohibited
  2014-06-04  7:39       ` Eric S Fraga
@ 2014-06-04  9:04         ` Eric Abrahamsen
  2014-06-04 16:52           ` AW
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2014-06-04  9:04 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Tuesday,  3 Jun 2014 at 22:14, AW wrote:
>
> [...]
>
>> Hi, 
>>
>> thank you, I started again digging into this strange thing and the culprit 
>> seems the first line of the html-file:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>>
>> If I remove this line, no error.  And removing simply 
>
> Have a look at 
>
> ,----[ C-h v org-html-xml-declaration RET ]
> | org-html-xml-declaration is a variable defined in `ox-html.el'.
> | Its value is
> | (("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
> |  ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
> | 
> | 
> | Documentation:
> | The extension for exported HTML files.
> | %s will be replaced with the charset of the exported file.
> | This may be a string, or an alist with export extensions
> | and corresponding declarations.
> | 
> | This declaration only applies when exporting to XHTML.
> | 
> | You can customize this variable.
> | 
> | [back]

Seems like simply exporting as html5 might solve the problem.

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

* Re: DTD prohibited
  2014-06-04  9:04         ` Eric Abrahamsen
@ 2014-06-04 16:52           ` AW
  2014-06-05 13:54             ` Rick Frankel
  0 siblings, 1 reply; 8+ messages in thread
From: AW @ 2014-06-04 16:52 UTC (permalink / raw)
  To: emacs-orgmode

Am Mittwoch, 4. Juni 2014, 17:04:14 schrieb Eric Abrahamsen:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> > On Tuesday,  3 Jun 2014 at 22:14, AW wrote:
> > 
> > [...]
> > 
> >> Hi,
> >> 
> >> thank you, I started again digging into this strange thing and the
> >> culprit
> >> seems the first line of the html-file:
> >> 
> >> <?xml version="1.0" encoding="utf-8"?>
> >> 
> >> If I remove this line, no error.  And removing simply
> > 
> > Have a look at
> > 
> > ,----[ C-h v org-html-xml-declaration RET ]
> > 
> > | org-html-xml-declaration is a variable defined in `ox-html.el'.
> > | Its value is
> > | (("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
> > | 
> > |  ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\"
> > |  ?>\"; ?>"))> | 
> > | Documentation:
> > | The extension for exported HTML files.
> > | %s will be replaced with the charset of the exported file.
> > | This may be a string, or an alist with export extensions
> > | and corresponding declarations.
> > | 
> > | This declaration only applies when exporting to XHTML.
> > | 
> > | You can customize this variable.
> > | 
> > | [back]
> 
> Seems like simply exporting as html5 might solve the problem.

Yes, it does, thank you. But the price is that tabulars lose the frames and 
lines. I did not invest whether due to export without those elements or 
because Word had issues with html5.

So I think I stick for the time being with customization of org-html-xml-
declaration.

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

* Re: DTD prohibited
  2014-06-04 16:52           ` AW
@ 2014-06-05 13:54             ` Rick Frankel
  0 siblings, 0 replies; 8+ messages in thread
From: Rick Frankel @ 2014-06-05 13:54 UTC (permalink / raw)
  To: AW; +Cc: emacs-orgmode

On 2014-06-04 12:52, AW wrote:
> Am Mittwoch, 4. Juni 2014, 17:04:14 schrieb Eric Abrahamsen:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> > On Tuesday,  3 Jun 2014 at 22:14, AW wrote:
> >
> > [...]
> >
> >> Hi,
> >>
> >> thank you, I started again digging into this strange thing and the
> >> culprit
> >> seems the first line of the html-file:
> >>
> >> <?xml version="1.0" encoding="utf-8"?>
> >>
> Seems like simply exporting as html5 might solve the problem.
> 
> Yes, it does, thank you. But the price is that tabulars lose the frames 
> and
> lines. I did not invest whether due to export without those elements or
> because Word had issues with html5.

It's because the html5 export has no default style for tables --
before opening in word, try opening the html in a browser, you will
see that xhtml-strict export adds style info to the table element, but 
xhtml5 doesn't.

If you want the same style in html5 as html4, try the following
preamble in your org file:

#+HTML_DOCTYPE: xhtml5
#+HTML_HEAD: <style type="text/css">
#+HTML_HEAD: table {
#+HTML_HEAD: border-top: thin solid gray;
#+HTML_HEAD: border-bottom: thin solid gray;
#+HTML_HEAD: }
#+HTML_HEAD: thead {border-bottom: thin solid grey;}
#+HTML_HEAD: td, th {padding: 6px;}
#+HTML_HEAD:</style>

FYI, here's the table definition output in html4:

<table border="2" cellspacing="0" cellpadding="6" rules="groups"
frame="hsides">

and html5

<table>

rick

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

end of thread, other threads:[~2014-06-05 14:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 10:40 DTD prohibited AW
2014-06-02 11:33 ` Bastien
2014-06-03  0:34   ` James Harkins
2014-06-03 20:14     ` AW
2014-06-04  7:39       ` Eric S Fraga
2014-06-04  9:04         ` Eric Abrahamsen
2014-06-04 16:52           ` AW
2014-06-05 13:54             ` Rick Frankel

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).