Is it possible to convert a string looking like this : "<count>2</count>"
in Nokogiri node <count>2</count>
? Thanks in advance.
Yes and it's quite straightforward, just do
Nokogiri::XML("<count>2</count>")
For instance:
pry(main)> Nokogiri::XML("<count>2</count>").children.first.to_s
=> "<count>2</count>"
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.