From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9v?= =?ISO-8859-1?Q?ue?=) Date: 2008-06-09T22:20:02+09:00 Subject: Re: Overwrite a File (rexml) Rob Boellaard wrote: > I am trying to get some simple create/update/delete xml-element to > work with REXML, but I run into trouble when writing to file. Here's a > code example: instead of using rexml, I'd suggest you 'xml/smart' which as a "modify" method. for example I'm using : XML::Smart.modify( "#{file}" ) do | doc | node=doc.root.find("//xhtml:p[@id = 'maj']", {"xhtml" => "http://www.w3.org/1999/xhtml"}).first if node node.text=File.stat("#{file}").mtime.strftime("m�j le %d %m %y %H:%M") puts "file '#{file}' updated!" else puts "No node \"//xhtml:p[@id = 'maj']\" for file '#{file}'!" end end in order to modify the date (writen in

<

) from file's mtime. -- Une B�vue