-
-
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
collect_namespaces: Different result since 1.5.6 #885
Comments
See this real-world example with multiple default namespace declarations (Signer and Signature nodes). |
Thanks for pointing this out. As mentioned in the relevant commit (c13f9a5) Nokogiri is relying on the underlying XML library to provide the namespaces. In this case, it's unclear to me what the "right" behavior is, since the return value is (as you point out) a hash and both namespaces cannot be returned. Rather than classifying this as a bug, I think the answer is that |
Yes, I don't see how you could touch Can I suggest |
Using these in my code (dcp_inspect) now: |
@wolfgangw |
Sure, define draft up? Where and how? |
@wolfgangw If you could make the changes you propose and submit a pull request, we can continue discussion over implementation there. This issue can be closed in favour. |
I'm going to close this, as it's not clear how we can fix this without changing the return value of |
Nokogiri::XML::Document#collect_namespaces
will return different results with version 1.5.5 and versions since 1.5.6 respectively.By the way: the sample below, while abstract and reduced, reflects real-world instance documents, not merely an academic exercise.
Consider this document with multiple default namespace scopes:
1.5.5:
1.5.6 and ever since:
This on ruby 2.0.0-p0. Reproducible with ruby 1.9.3-p194 / libxml 2.8.0.
Apart from the changed behaviour: Facing a document like the sample above (perfectly valid XML, I believe) a namespaces hash with attributes as keys won't fly, right? A list would. And break a million systems along the way. Essentially I'm looking for the proper mechanism to process these documents. Any hint appreciated.
By the way, the comment
Non-prefixed default namespaces (as in “xmlns=”) are not included in the hash.
on Nokogiri's::XML::Document#collect_namespaces needs updating.The text was updated successfully, but these errors were encountered: