How to modify a text value in a xml?

Hi, folks
I met a problem with xml. I can't write to the file directly, here is my
code:

f = File.open(FILE_NAME)
xml = REXML::Document.new(f)

xml.root.each_element do |xml|
  xml.each_element do |node|
    #if the node name equal to Properties
    if node.name == "Properties"
      node.each_element do |child|
        #Get the child of Properties
        if child.name == "Name"
          #If the text equal to English, modified to the text to ABC
          if child.get_text == "English"
             #What should I put here?
             child.text = "ABC"
             xml.write(f)
          end
        end
      end

    end
  end
end

f.close

I want all the contents the same as the original file except the text of
the node "Name".
How can I do that?

Thanks very much.

BR,
Milo

···

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