From: brabuhr@... Date: 2010-07-16T22:48:39+09:00 Subject: Re: help please with REXML On Fri, Jul 16, 2010 at 1:23 AM, Ben Morse wrote: > hello, > > I am trying to make a simple ruby script that can look at a set of xml > files, and make a set of folders based on the content of the XML files. > As it stands I can import the data with REXML, but when I run the script > I get a set of errors(I posted below the code) talking about TypeError. > > Take a look below and let me know what you think.. $ ruby /tmp/code_below /tmp/code_below:6:in `initialize': No such file or directory - XML_EXPORT/export_j_number.xml (Errno::ENOENT) from /tmp/code_below:6:in `new' from /tmp/code_below:6 Beyond that, is the posted code the same code that produced your sample output? 44 j.client_name = cname 46 j.job_name = cname But, cname is never set to anything before this point (or after). 9 cname_file = File.new("XML_EXPORT/export_c_name.xml") 14 cname_file = Document.new(cname_file) 19 puts cname_file But, cname_file is never used after this point. 18 puts cnumbe_file There is no cnumbe_file. 26 client_dir = @client_num.to_s + "_" + @client_name @client_num comes from: 45 j.client_num = cnumberfile 13 cnumber_file = Document.new(cnumber_file) @client_name comes from: 44 j.client_name = cname Should that have been?: 44 j.client_name = cname_file 14 cname_file = Document.new(cname_file) So, in line 26 we have something like: 26 client_dir = .to_s + "_" + 26 client_dir = + "_" + 26 client_dir = + TypeError: can't convert REXML::Document into String