sparklemotion/nokogiri — pull request #812 by mbklein (2012-12-19 17:20:23+00:00)
Title: JRuby & Builder namespace improvements

I thought about splitting this into two separate pull requests, but everything's so intertwined. This change does three things:

1. Add tests for how I *think* Nokogiri is trying to handle namespaces and namespace inheritance – at least tests that are consistent with how most code I've come across expects namespaces to work.
2. Fix the node renaming issues that were causing Xerces to throw NAMESPACE_ERR exceptions in certain (sometimes inconsistent) circumstances.
3. Give Nokogiri::XML::Builder the ability to handle namespace prefixes that won't be formally declared until the first `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.