-
-
Notifications
You must be signed in to change notification settings - Fork 904
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 & Builder namespace improvements: Take 2 #846
Conversation
* Untangle handling of namespaces in JRuby * Secure XmlNode and NokogiriNamespaceCache against internal node object changes
This fixes #801 so I urge it be accepted into the official branch. |
All namespace-related tests now pass on both CRuby and JRuby. |
This is the last of my commits for now. All tests now pass in the travis-ci environment under jruby (18mode and 19mode), MRI (1.8.7, 1.9.3, 2.0.0-rc1, and head), and the last release of ree. rbx-18mode segfaults, but does that anyway under master, so I can't see it affecting the viability of this pull request. |
👍 Having proper namespace support is pretty essential for the library metadata community. |
+1 and thank you for the testing baseline |
+1 Nokogiri has handled namespaces inconsistently for a long time, causing a lot of frustration for me and others. Having looked at code and discussed with mbklein, I think this solves a lot of the issues and makes the internals fundamentally rational and sane here. If this gets applied, I would try to do some documentation updates to match, if needed. (I've had a couple docu patches accepted before around namespaces, as I tried to figure out what the heck the inconsistent behavior was) |
I'll review tonight and put in the RC if all looks good.
|
So, any hope? |
if(reparented->ns == NULL || reparented->ns->prefix == NULL) { | ||
name = xmlSplitQName2(reparented->name, &prefix); | ||
|
||
if(reparented->type == 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block doesn't appear to have test coverage.
Made two comments at https://github.com/sparklemotion/nokogiri/pull/846/files#L4R36 about lack of test coverage. I've also made a subsequent commit to change magic numbers to constants. If you've got a response on the test coverage, let me know. In the meantime, I'm merging and this will be part of 1.5.7.rc2. |
Thanks! I'll take a look at the test coverage and add whatever's missing in the next few days. |
Having screwed up the commit history on my previous pull request, I'm trying again.
I thought about splitting this into two separate pull requests, but everything's so intertwined. This change does three things:
method_missing
call (e.g.,xml[:foo].bar(:'xmlns:foo' => 'baz')
). The ArgumentError will still be raised if the new prefix isn't declared by the first element encountered.The libxml C version of Nokogiri still doesn't pass the "expected namespace behavior" tests, but this at least establishes a common baseline for the two.EDIT: The C extension now behaves the same as the Java extension as far as namespaces are concerned.