class Nokogiri::XML::Node
def namespaces
default namespaces set on ancestor will NOT be, even if self
set on self will be included with key "xmlns". However,
such as "xmlns:prefix", not just the prefix. Default namespace
XML attributes that would be used to define this namespace,
attribute-name/value pairs. Note that the keys in this hash
element directly or any ancestor node -- as a Hash of
Returns namespaces in scope for self -- those defined on self
This method returns the same namespaces as #namespace_scopes.
node and its ancestors.
Returns a Hash of {prefix => value} for all namespaces on this
##
def namespaces Hash[*namespace_scopes.map { |nd| key = ['xmlns', nd.prefix].compact.join(':') if RUBY_VERSION >= '1.9' && document.encoding begin key.force_encoding document.encoding rescue ArgumentError end end [key, nd.href] }.flatten] end