View Single Post
Old 07-03-2017, 10:36 PM   #209
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,729
Karma: 205159604
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by slowsmile View Post
It appears that setmetadaxml() is deliberately removing 'dc:' from my data.
setmetadatxml() isn't removing the 'dc:' prefixes. Sigil is doing that after your plugin is done running. It's because the metadata tag you're creating and writing back to the opf file is insufficient. It does not contain the dc namespace declaration:

Code:
xmlns:dc="http://purl.org/dc/elements/1.1/"
Without this, Sigil's opf/xml parsing routines won't know how to handle the dc prefixes. So they get stripped (delete the dc namespace declaration from the metadata tag in any existing epub's OPF and the same thing will happen).

Look at the metadata tag properties in the OPF of Sigil's empty epub template for an example of the namepace declaration(s) you need to provide for the metadata tag that you ultimately hand back to the setmetadataxml() function if you're using dc metadata.

Instead of:
Code:
data =  ('  <metadata>')
You need something more like:
Code:
data =  ('  <metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/">')

Last edited by DiapDealer; 07-03-2017 at 10:45 PM.
DiapDealer is online now   Reply With Quote