From: fox foxmaster Date: 2012-04-27T19:21:42+09:00 Subject: Re: if if if statment Lars Haugseth wrote in post #1058449: > First, you need to parse the source XML into a DOM object: > > require 'nokogiri' > > dom = Nokogiri::XML(File.read source_file) > > Then you iterate over all InterfaceGroup nodes and modify attributes: > > dom.xpath("//InterfaceGroup").each do |node| > node['Members'] = "some value" > end > > Finally, write the modified DOM to the target XML file: > > File.open(target_file, "w") { |f| f.write dom.to_xml } Hi Lars and thanks, When I do this it will insert it like I want but is it also possible to make a newline like I did with the "old" variant? Or is it better to first add the lines withe the old variant and then read that file with nokogiri and insert to the group lines? Hope I can make myself understood. Regards Fox -- Posted via http://www.ruby-forum.com/.