From: Aldric Giacomoni <"aldric[remove]"@...> Date: 2008-12-30T23:39:34+09:00 Subject: Re: rexml/document : one tag not closing Robert Klemme wrote: > On 30.12.2008 02:31, Aldric Giacomoni wrote: >> Ruby 1.8.6 on Windows. The following code runs fine.. But I don't get >> the that I expect between and >> . I can't figure out what I'm doing wrong.. >> >> require 'rexml/document' >> doc = REXML::Document.new >> datasource = doc.add_element 'DataSources' >> datasource.add_element( 'DataSource', {'Name' => 'LOCAL', 'Type' => >> "Cedara DbS P10", 'Default' => '', >> 'MaxLimit' => 500}) >> schema = datasource.add_element 'Schema' >> schema.add_text "DbSP10Schema.xml" >> connectionstring = datasource.add_element 'ConnectionString' >> connectionstring.add_text "Provider=ISG OLE DB DbS Provider; Data >> Source=localhost:3205" >> >> doc.write > > This is because you did not add nested elements to DataSource. My > output looks like this > > irb(main):013:0* doc.write > Type='Cedara DbS > P10'/>DbSP10Schema.xmlProvider=ISG > OLE DB DbS Provider; Data > Source=localhost:3205=> [ ?>, ... ] > > This is because you probably confused DataSources and DataSource. > Your variable named "datasource" holds DataSources and so you add > Schema to that instead of to DataSource. > > Kind regards > > robert > Understood! Thank you! --Aldric