I am reading the book Programming Amazon Web Services by James Murty. In the book he says "In this book we will demonstrate how to parse and create XML documents using the Ruby library called REXML." Then says "To demonstrate how to use this XPath in Ruby, we have saved the XML document to a file named example.xml, and we will use the REXML Ruby library to parse and query this document in an interactive Ruby session." And starts giving the following commands:
# Load the XML document text from a file
irb> xml_text = File.new('example.xml', 'r').read
# Load Ruby's XML handling library REXML
irb> require 'rexml/document'
# Parse the XML text in to a document object using REXML
irb> xml_doc = REXML::Document.new(xml_te
xt)
# Define an XPath query string
irb> xpath = '/ListAllMyBucketsResult/B
uckets/Buc
ket/Name'
# Perform the XPath query on the document and print the results
irb> xml_doc.elements.each(xpat
h) do |result|
irb> puts result
irb> end
<Name>oreilly-aws</Name>
<Name>my-bucket</Name>
What I can't figure out is where I am running RUBY! I have RUBY 1.86.26 loaded on my computer cannot figure out where I'm entering the commands to get the thing to do the above. I wanted to program Amazon AWS, not learn RUBY! Any clue where I run this thing...???
Start Free Trial