File.open("xml.xml") do |f|
  e = f.each

  IO.foreach("html.htm") do |line|
    puts "----#{line}"
    puts "****#{e.next}"
  end
end


--output:--

----<!DOCTYPE html>
****<?xml version="1.0"?>
----<html>
****<note>
----  <head>
****
----    <title>Test</title>
****  <name>Tove</name>
----    <script type='text/javascript' 
src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script>
****  <garbage>xxxx</garbage>
----    <script type='text/javascript' src='my_js.js'></script>
****  <value>Tove's value is: 10</value>
----
****
----    <script type='text/javascript'>
****  <to>Tove</to>
----
****  <from>Jani</from>
----      $(document).ready(function() {
****  <heading>Reminder</heading>
----          $('#my_table td').addClass('edit').click(function() {
****  <body>Don't forget me this weekend!</body>
----            $(this).parentNode('tr').children('td').first().click();
****
----
****  <parent>
----          });
****    <name>Jani</name>
----
****    <garbage>xxxx</garbage>
----          $(".edit").editable('#');
****    <garbage>xxxx</garbage>
----
****    <value>Jani's value is: 20</value>
----
****    <value>1200</value>
----      $('#my_checkbox').click(function() {
****  </parent>
----        var current_display = $('#my_div').css('display');
****
----        var new_display = (current_display == 'none') ? 'block' : 
'none';
****  <parent>
----        $('#my_div').css('display', new_display);
****    <name>Diane</name>
----        });
****  </parent>
----
****  <value>Diane's value is: 30</value>
----
****
----
****</note>
----      });
****
----
ruby.rb:6:in `next': iteration reached an end (StopIteration)
  from ruby.rb:6:in `block (2 levels) in <main>'
  from ruby.rb:4:in `foreach'
  from ruby.rb:4:in `block in <main>'
  from ruby.rb:1:in `open'
  from ruby.rb:1:in `<main>'

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