Nokogiri parsing Rackspace return using XPath in Rails
Posted
by Schroedinger
on Stack Overflow
See other posts from Stack Overflow
or by Schroedinger
Published on 2010-05-24T05:48:21Z
Indexed on
2010/05/24
5:51 UTC
Read the original article
Hit count: 266
Hey guys,
I'm using Nokogiri to parse a return from the Rackspace API so I'm using their sample code to
response = server.get '/customers/'[email protected]_id.to_s+'/domains/', server.xml_format
doc = Nokogiri::XML::parse response.body
puts "xpath values"
doc.xpath("//name").each do |node|
puts
node.text
end
As my code to use Nokogiri to return the nodelist of nodes of the element
for some reason I seem to have missed something obvious and I just for the life of me cannot get it to parse the list of nodes and return them to me, is there something simple I can do to fix to have it return the list of nodes?
Cheers
© Stack Overflow or respective owner