From: Henrik Horneber Date: 2004-10-13T01:19:25+09:00 Subject: Re: rexml error - REXML::Validation Daniel Berger wrote: > Hi all, > > >>ruby -v > > ruby 1.8.2 (2004-10-11) [sparc-solaris2.9] > > This bit of code, that seemed to work fine on 1.8.1, is now choking: > > require "rexml/document" > include REXML > > file = "some_file" > database = "foo" > > doc = Document.new(File.new(file)) > ary = doc.elements.to_a("//name[text()='#{database}']") ary = doc.elements["//name[text()='#{database}']"] # does not make a difference, but I like it better > parent = ary[0].parent > > Running this bit of code, I get: > > opt/lib/ruby/site_ruby/1.8/rexml/parsers/treeparser.rb:80:in `parse': > uninitialized constant REXML::Validation (NameError) > from /opt/lib/ruby/site_ruby/1.8/rexml/document.rb:175:in > `build' > from /opt/lib/ruby/site_ruby/1.8/rexml/document.rb:45:in > `initialize' > from rexmltest.rb:7:in `new' > from rexmltest.rb:7 > > I tried installing rexml 3.1.1 from the RAA but I get the same error. > Actual XML is as follows: > > > foo > user1 > pwd1 > Oracle > 60 > 40 > 3 > > > foo > user2 > pwd2 > OCI8 > 60 > 60 > 4 > > > bar > user1 > pwd3 > Oracle > 30 > 30 > 2 > > > baz > user3 pwd4 > > > > > Any ideas? hope that helps. After fixing the typo the script runs without errors, even with your original line. C:\>ruby -v ruby 1.8.2 (2004-07-16) [i386-mswin32] Henrik