Ruby on rails Rails 3到xml问题
我正在尝试使用Rails对XML的Ruby on rails Rails 3到xml问题,ruby-on-rails,xml,Ruby On Rails,Xml,我正在尝试使用Rails对XML的生成一个简单的XML提要: xml = { :id => '1234', :title => 'Title', :url => 'www.site.com', :items => items.to_xml(:skip_instruct => true, :skip_types => true, :include => :user) }.to_xml(:root => 'feed', :sk
生成一个简单的XML提要:
xml = {
:id => '1234',
:title => 'Title',
:url => 'www.site.com',
:items => items.to_xml(:skip_instruct => true, :skip_types => true, :include => :user)
}.to_xml(:root => 'feed', :skip_types => true)
这种方法有两个问题:
中的所有内容都是ECscape并呈现为常规文本李>
它会生成一个附加的
节点
因此,生成的
节点如下所示
<items>
<items> ... </items>
<items>
项目/项目
仅使用to_xml
如何使其工作?您应该能够使用以下语法:
xml = {
:id => '1234',
:title => 'Title',
:url => 'www.site.com',
:items => items
}.to_xml(:root => 'feed', :skip_types => true)
应用于整个转换的任何选项都应(?)应用于项转换