Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 20th, 2012  |  syntax: None  |  size: 0.37 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require "nokogiri"
  2.  
  3. xml = Nokogiri::XML(File.open("some_shit.xml"))
  4.  
  5. xml.at_css("xmldata")
  6. # => nil
  7.  
  8. xml.xpath("//soap12:Envelope")
  9. # => works, returns element and children
  10.  
  11. xml.xpath("//soap12:Envelope//soap12:Body")
  12. # => works, returns element and children
  13.  
  14. xml.xpath("//soap12:Envelope//soap12:Body//postdata")
  15. # => suddenly does not work, won't detect the <postdata> element