How to tell Builder to not to escape values

那年仲夏 提交于 2019-12-10 03:19:09

问题


ruby-1.8.7-p249 > xml = Builder::XmlMarkup.new
 => <inspect/> 
ruby-1.8.7-p249 > xml.foo '<b>wow</b>'
 => "<inspect/><foo>&lt;b&gt;wow&lt;/b&gt;</foo>" 
ruby-1.8.7-p249 > 

Builder is escaping the content and is converting the b tag into an escaped value. How do I tell Builder to not escape it? I am using Ruby 1.8.7.


回答1:


Builder::XmlMarkup#<<

xml.foo do
  xml << '<b>wow</b>'
end


来源:https://stackoverflow.com/questions/2693036/how-to-tell-builder-to-not-to-escape-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!