mik
mik copied to clipboard
Provide option to add additional namespaces to MODS XML
If the XML within an <extension>
element uses a namespace prefix, PHP's DOM complains. We should allow the addition of namespaces to the MODS XML files in the [METADATA_PARSER] sections of .ini files to accommodate this.
namespaces[] = thesis:http://www.ndltd.org/standards/metadata/etdms/1.1/
This feature may also be useful if people write metadata manipulators that add non-MODS namespaced elements.
Work in the issue-170 branch adds namespaces registered in the .ini file to the MODS document within the metadata parser, but the metadata manipulators don't like the namespaced elements coming in without a corresponding namespace declaration. In other words, namespaced elements withing <extension>
break the metadata manipulators.
Declaring the namespace locally in the mapping, like this:
null1,<extension><thesis xmlns="http://www.ndltd.org/standards/metadata/etdms/1.1/"><degree xmlns="http://www.ndltd.org/standards/metadata/etdms/1.1/">Masters</degree></thesis></extension>
is totally legal and produces output like this, which validatates:
<extension>
<thesis xmlns="http://www.ndltd.org/standards/metadata/etdms/1.1/">
<degree>Masters</degree>
</thesis>
</extension>
The document-level namespace declaration is redundant if we do this but might be a useful feature anyway if people write metadata manipulators that add non-MODS namespaced elements.
Strangely, this mapping:
null1,<extension><thesis xmlns="http://www.ndltd.org/standards/metadata/etdms/1.1/"><degree>Masters</degree></thesis></extension>
produces the exact same output as the previous mapping:
<extension>
<thesis xmlns="http://www.ndltd.org/standards/metadata/etdms/1.1/">
<degree>Masters</degree>
</thesis>
</extension>
I'm willing to close this. The Templated metadata parser will allow addition of arbitrary namespaces.