Quote:
Originally Posted by slowsmile
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/">')