mik icon indicating copy to clipboard operation
mik copied to clipboard

Provide option to add additional namespaces to MODS XML

Open mjordan opened this issue 9 years ago • 3 comments

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.

mjordan avatar Feb 22 '16 22:02 mjordan

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.

mjordan avatar Feb 23 '16 00:02 mjordan

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>

mjordan avatar Feb 23 '16 02:02 mjordan

I'm willing to close this. The Templated metadata parser will allow addition of arbitrary namespaces.

mjordan avatar Apr 29 '18 18:04 mjordan