Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register Namespace Ordering #213

Open
billy1kaplan opened this issue Feb 6, 2023 · 2 comments
Open

Register Namespace Ordering #213

billy1kaplan opened this issue Feb 6, 2023 · 2 comments
Assignees

Comments

@billy1kaplan
Copy link

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?

@billy1kaplan
Copy link
Author

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

@mvz
Copy link
Owner

mvz commented Feb 7, 2023

Yes, it makes sense to allow more control over this.

@mvz mvz self-assigned this Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants