Skip to content

Instantly share code, notes, and snippets.

@zeero
Created March 24, 2011 09:46
Show Gist options
  • Save zeero/884810 to your computer and use it in GitHub Desktop.
Save zeero/884810 to your computer and use it in GitHub Desktop.
find all xml namespaces with nokogiri
doc.xpath("//namespace::*").map{|ns|{ns.prefix => ns.href}}.uniq # => [{"xml"=>"http://www.w3.org/XML/1998/namespace"}, {nil=>"http://parts.com/"}, {nil=>"http://alicesautoparts.com/"}, {nil=>"http://bobsbikes.com/"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment