sul-dlss / mods_display

MODS Display is a gem to centralize the display logic of MODS medadata.
Other
2 stars 5 forks source link

Munge nested related items nodes instead of trying to re-parse it from strings #105

Closed cbeer closed 2 years ago

cbeer commented 2 years ago

The string concatenation approach doesn't play nice with documents with a non-default prefix (resulting in MODs documents like:

<mods xmlns="...">
  <mods:titleInfo>...</mods:titleInfo>
</mods>

Note the default xmlns, and the un-bound prefix mods:..)

... but there's no reason to parse and reparse the document in the first place, when we can just munge the parsed data to match what we expect.

This wasn't a problem with the previous version of mods_display because we just stripped all the XML namespaces... it's also not clear that it's an actual problem with our production data because it all seems to use MODS as the default namespace, but better safe than sorry.

cbeer commented 2 years ago

PR description updated with the gory context... tl;dr is we are doing something hacky and it doesn't account for all the ways XML could be expressed.