Browse the Ruby on Rails Community.

You are here: Forums Ask a Rails expert how to update xml file ...

Replytotopic

how to update xml file

Posted in Forums : Ask a Rails expert

 
Profile

Authority 0
Posting Rating 45
Sign in to rate this post

Hi i am trying to update xml file but it always write instead of update

File.open(xml_file_descripation,”w”) do |outfile| out_doc.write(xml_file_descripation, 0)
end
where xml_file_descripation is the new element in the xml how to update Is any one idea about this

 
Me

Authority 62
Posting Rating 100
Sign in to rate this post

“w” starts writing at the beginning of the file. If you need to append something (I guess that’s what you mean with update), you’d have to use “a”. See for example here.

Replytotopic

Other Recent Topics

Ask a Rails expert : json gem error

Ask a Rails expert : Problem with break

Ask a Rails expert : activesupport string first method error

Ask a Rails expert : url_for broken ?

Ask a Rails expert : map.routes.rb pls help

Ask a Rails expert : how to h tag in controller

Ask a Rails expert : Problem with Restful routing and partial form

Ask a Rails expert : will_paginate, search and ajax

Ask a Rails expert : captcha

Ask a Rails expert : Mass Deletes in Admin Section

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel