# File lib/rest.rb, line 24
  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 ) )
      FileUtils.mkdir_p output_dir
      if ( $? != 0 )
        puts $stderr, "Unable to create directory '#{dir_name}'"
      end
    end
    src_file = find_file( file_name )

    stat_out = File.stat output_dir
    stat_src = File.stat File.dirname src_file

    # do not copy to itself
    unless stat_out.dev == stat_src.dev && stat_out.ino == stat_src.ino
      FileUtils.cp( src_file, output_dir ) 
    end
  
  end