-
-
Notifications
You must be signed in to change notification settings - Fork 903
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
JRuby on re-homing a default-namespaced node, preserves namespace but does not reflect in xmlns attrib, inconsistent with MRI #1774
Comments
@jrochkind Thanks for the thorough bug report. |
This seems possibly related to #1469. Except, if I'm reading that code correctly (I have not executed it), I believe MRI Nokogiri is already doing what the issue-opener there is asking for (which I agree is correct and consistent with best practices exhibited by other top-of-the-line XML libraries), just not in JRuby. Maybe it changed (accidentally?) in between then and now in MRI, but not JRuby? But I haven't excecuted that code in #1469 or totally wrapped my head around it, it could be a slightly different case. |
* ext/java/nokogiri/XmlNode.java (relink_namespace): Add a namespace attribute to the new adopted node, if the current scope namespace URI or prefix don't match the new node's namespace. Fixes #1774
Fixed in #1778. I would like someone to review the newly added tests to make sure they are idiomatic and make sense. |
* ext/java/nokogiri/XmlNode.java (relink_namespace): Add a namespace attribute to the new adopted node, if the current scope namespace URI or prefix don't match the new node's namespace. Fixes #1774
MRI nokogiri version
Jruby nokogiri version
reproduction
So in JRuby, doing
Nokogiri::XML.parse(new_doc.to_xml)
would actually result in a different internal document as it would lose the namespace. In MRI, it would be round-trippable.The text was updated successfully, but these errors were encountered: