From: daz Date: 2005-10-28T17:57:04+09:00 Subject: Re: How to merge two files like the following with the XML parser Karen wrote: > > I want a generic script that can merge file1.txt and > file2.txt to generate file3.txt > a1 = File.read(ARGV[0]).split(/\n/) # SCREEN, ... File.open(ARGV[2], 'w') do | f3 | # output IO.foreach(ARGV[1]) do | lin2 | # S1,P1,F11, ... a2 = lin2.chomp.split(/,/) a1.each_index do | ix | f3.puts "#{a1[ix]}#{a2[ix]}" end end end > > Appreciate if you could kindly share how to get > this done with the XML parser. > The task is so simple, you needn't go near XML parser but you can access that from Ruby like so: require 'win32ole' xmp = WIN32OLE.new('Microsoft.XMLDOM') puts xmp.ole_methods.sort_by {|e| e.name} Try googling: win32ole "Microsoft.XMLDOM" Ask here if you're stuck. daz