Skip to content

Instantly share code, notes, and snippets.

@djberg96
Created July 5, 2016 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djberg96/04b0723ff72339a0ab6ddd434bf05ccf to your computer and use it in GitHub Desktop.
Save djberg96/04b0723ff72339a0ab6ddd434bf05ccf to your computer and use it in GitHub Desktop.
require 'nokogiri'
str = "#< CLIXML\r\n<Objs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\"><S S=\"Error\">Stuff</S></Objs>"
doc = Nokogiri::XML::Document.parse(str)
doc.remove_namepaces!
p doc.xpath("//S") # => [], why?
# REXML equivalent of what I want
doc = REXML::Document.new(str)
p doc.root.get_elements('//S')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment