sparklemotion/nokogiri — pull request #1058 by 2potatocakes (2014-02-27 12:56:51+00:00)
Title: Fix for #843 - the xml reader bombs out when trying access attribute namespaces

See #843 for an example of the issue.

Was hoping for some help with this if anyone can lend a hand. Have added a test case but it fails under jruby.

*Please note* sadly.. my C skills are below par also and I don't understand the reasoning behind the 'assert' call being in the following method in the first place. So feel free to correct me if I'm wrong. But I noticed while reading the comments in the 'Nokogiri_wrap_xml_node' method that the reader doesn't have access to the document object but it appears like the 'Nokogiri_wrap_xml_namespace' method below is expecting it and so reader.attribute_nodes crashes while trying to access anything to do with the attribute namespaces. I just reordered the method as below and it allows the XML::Reader to call attribute_nodes properly giving access to the attribute namespaces properly.

If you copy and paste the test case into master you should be able to see the test suite crash.