Skip to content

Instantly share code, notes, and snippets.

@lucasdavila
Created November 12, 2012 23:24
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 lucasdavila/4062767 to your computer and use it in GitHub Desktop.
Save lucasdavila/4062767 to your computer and use it in GitHub Desktop.
xpath in ruby with nokogiri
source "http://rubygems.org"
gem 'nokogiri'
require 'rubygems'
require 'nokogiri'
xml_file = File.open 'file.xml'
xml_doc = Nokogiri::XML xml_file
xml_file.close unless xml_file.nil?
puts xml_doc.xpath '//@attrName'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment