dvschultz / 99problems

99 Problems and e-reader rendering are all of them
60 stars 3 forks source link

kindlegen complains about a closing </image> tag in SVG #47

Open gimsieke opened 9 years ago

gimsieke commented 9 years ago

Consider the embedded SVG code of #46. When processing it, kindlegen complains:

Warning(inputpreprocessor):W29008: Tag rejected due to improper usage: </image> in file: /tmp/mobi-ktXBEY/OEBPS/cover.xhtml

So this is not ok:

<image xlink:href="images/000-0-0000-0000-0_front.jpg" width="1000" height="1594"></image>

While this is ok:

<image xlink:href="images/000-0-0000-0000-0_front.jpg" width="1000" height="1594" /> 

Unfortunately, when we are using the 'xhtml' serialization method of Saxon/Calabash, the image element within embedded SVG will be serialized with an explicit closing tag. This should be no issue when the input is XHTML with embedded SVG; an XML parser should see no difference between the two variants.

What kindlegen apparently does: Read the opening image tag as an empty HTML5 elemen that doesn’t need to be terminated by '/>'. From that standpoint, it might seem reasonable to consider the additional “tag” </image> as misplaced.

However, as kindlegen is processing XHTML with embedded XML rather than HTML5, it should treat its input as such.

Luckily, the resulting .mobi file seems to be ok. So this warning may safely be ignored.

It is, however, a reminder that the vendors don’t just put crappy sofware into devices. They also provide crappy software for content conversion.