![](/img/trans.png)
[英]Consume webservice in Ruby on Rails, how to change XML tags and authentication?
[英]removing the xml tags in ruby on rails
我正在从xml文档中读取数据,并使用rails和REMXL将其放在网页上。 我用
@description1=XPath.match( xmldoc, "////description" )
将信息放入数组并在我的视图中循环浏览。 但是当使用
<%= h(@description1[k]) %>
所以看起来
<description>fuzzy slippers</description>
在网页上。 是否有删除标签的好方法? 谢谢
您可能需要研究httparty: http ://github.com/jnunemaker/httparty
你试过了吗
<%= h(@description1[k].text) %>
它显示什么?
您正在使用的xpath将返回一组节点。 要仅获取内容,请使用:
@description1 = XPath.match(xmldoc, "////description/text()")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.