I am reading data from an xml doc and placing it on a web page using rails and REMXL. I use
@description1=XPath.match( xmldoc, "////description" )
to get the info into an array and just loop through in my view. However when using
<%= h(@description1[k]) %>
so it looks like
<description>fuzzy slippers</description>
on the web page. Is there a good way of removing the tags? Thanks
您可能需要研究httparty: http ://github.com/jnunemaker/httparty
Did you try
<%= h(@description1[k].text) %>
What does it show?
The xpath you are using will return a set of nodes. To get only the content, use:
@description1 = XPath.match(xmldoc, "////description/text()")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.