Created
November 12, 2012 23:24
-
-
Save lucasdavila/4062767 to your computer and use it in GitHub Desktop.
xpath in ruby with nokogiri
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "http://rubygems.org" | |
gem 'nokogiri' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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