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..
________________________CODE_________________________
#!/usr/bin/ruby

require 'rexml/document'
include REXML

jnumber_file = File.new("XML_EXPORT/export_j_number.xml")
jname_file = File.new("XML_EXPORT/export_j_name.xml")
cnumber_file = File.new("XML_EXPORT/export_cnumber.xml")
cname_file = File.new("XML_EXPORT/export_c_name.xml")

jnumber_file = Document.new(jnumber_file)
jname_file = Document.new(jname_file)
cnumber_file = Document.new(cnumber_file)
cname_file = Document.new(cname_file)

puts jnumber_file
puts jname_file
puts cnumbe_file
puts cname_file

class Job
  attr_accessor :client_num, :client_name, :job_num, :job_name;

  def generate_files()
    # print "Client Num is " + @client_num.to_s +   "\n"
    client_dir = @client_num.to_s + "_" + @client_name
    job_dir = @job_num.to_s + "_" + @job_name
    if(! File.exist?(client_dir))
      Dir.mkdir(client_dir);
    end
    Dir.mkdir(client_dir+"/"+job_dir);

    Dir.mkdir(client_dir+"/"+job_dir+"/parent");
    Dir.mkdir(client_dir+"/"+job_dir+"/parent/old");
    Dir.mkdir(client_dir+"/"+job_dir+"/parent/current");

    Dir.mkdir(client_dir+"/"+job_dir+"/children");
    Dir.mkdir(client_dir+"/"+job_dir+"/children/old");
    Dir.mkdir(client_dir+"/"+job_dir+"/children/current");
  end
end

j = Job.new
j.client_name = cname
j.client_num = cnumberfile
j.job_name = cname
j.job_num = jname_file
j.generate_files()
____________________________END CODE_________________________
____________________________ERROE____________________________

director_v3.rb:28:in `+': can't convert REXML::Document into String
(TypeError)
  from director_v4.rb:28:in `generate_files'
  from director_v4.rb:50
____________________________END ERROR________________________


Anything yall can see to help would be awsome!

Thanks
-- 
Posted via http://www.ruby-forum.com/.