happymapper
happymapper copied to clipboard
Register Namespace Ordering
I am dealing with a very fickle XML parser that requires the XML namespaces to be registered in a certain order.
For example, this passes:
<Root xmlns:ns1="..." xmlns:ns2="...">
</Root>
While this fails:
<Root xmlns:ns2="..." xmlns:ns1="...">
</Root>
Would it be possible to output the namespaces in the order that they were registered?
Looking at the code: https://github.com/mvz/happymapper/blob/a650cecc262c0afcd8012cd5da1665e076abd4da/lib/happymapper.rb#LL92C33-L92C33
This might be as simple as changing:
@registered_namespaces.merge!(name => href)
to
@registered_namespaces[name] = href
Yes, it makes sense to allow more control over this.