On Mon, Nov 29, 2010 at 4:09 PM, Rajinder Yadav <devguy.ca / gmail.com> wrote:
>
> James,
>
> thanks, xml-simple does what I was looking for. Do you know if there
> is a similar thing that can be done with nokogiri?


You may want to check out Nokogiri's "slop" mode (invented by the
inestimable John Barnette):

    require 'rubygems'
    require "nokogiri"

    doc = Nokogiri::Slop <<-EOXML
    <employees>
      <employee status="active">
        <fullname>Dean Martin</fullname>
      </employee>
      <employee status="inactive">
        <fullname>Jerry Lewis</fullname>
      </employee>
    </employees>
    EOXML

    # navigate!
    doc.employees.employee.last.fullname.content # => "Jerry Lewis"

    # access node attributes!
    doc.employees.employee.first["status"] # => "active"

    # use some xpath!
    doc.employees.employee("[@status='active']").fullname.content # => "Dean
Martin"
    doc.employees.employee(:xpath => "@status='active'").fullname.content #
=> "Dean Martin"

    # use some css!
    doc.employees.employee("[status='active']").fullname.content # => "Dean
Martin"
    doc.employees.employee(:css => "[status='active']").fullname.content #
=> "Dean Martin"