class Nokogiri::XML::Document
def collect_namespaces
implementation of the underlying XML library.
namespaces, and as a result the order may be dependent on the
Note that this method does an xpath lookup for nodes with
in the hash.
Non-prefixed default namespaces (as in "xmlns=") are not included
The hash returned will look like this: { 'xmlns:foo' => 'bar' }
For example, given this document:
WARNING: this method will clobber duplicate names in the keys.
{ 'xmlns:foo' => 'bar', 'xmlns:hello' => 'world' }
This method will return:
For example, given this document:
return them as a hash.
Recursively get all namespaces from this node and its subtree and
#
def collect_namespaces xpath("//namespace::*").inject({}) do |hash, ns| hash[["xmlns",ns.prefix].compact.join(":")] = ns.href if ns.prefix != "xml" hash end end