From: peri Date: 2007-07-11T22:18:51+09:00 Subject: Update existing doc with REXML I have been searching around the forums and the documentation, but I do not see any examples/topics on how to open an existing XML document and update a value (element's text value, for example) using REXML. Is it even possible? All I have for a workaround is overwriting the existing file using document.write. Am I missing something obvious here? Below is an example I am trying to work with: #=========================================== doc = Document.new File.read('cars.xml') doc.root.each_element("//vehicle[make='Ford']") do |file_node| file_node.elements['method'].text = "U" end File.open('cars.xml','w') do |f| f.write doc.write end