# File lib/rest.rb, line 22
  def XmlFile.copy file_name, output_dir
    dir_name = File.dirname( file_name )

    if ( dir_name =~ /^\// )
      puts STDERR, "Absolute file names aren't allowed as XML file names."
        + " (#{dir_name})";
      return
    end

    if ( dir_name )
      output_dir += "/" + dir_name
    end
    
    if ( dir_name && !dir_name.empty? && !File.exist?( dir_name ) )
      `mkdir -p #{output_dir}`
      if ( $? != 0 )
        puts STDERR, "Unable to create directory '#{dir_name}'"
      end
    end
    src_file = find_file( file_name )
    unless File.absolute_path(output_dir) == File.absolute_path(File.split( src_file).first)
      # do not copy to itself
      FileUtils.cp( src_file, output_dir ) 
    end
  
  end