Reputation: 109
Is it possible to convert a string looking like this : "<count>2</count>"
in Nokogiri node <count>2</count>
? Thanks in advance.
Upvotes: 2
Views: 532
Reputation: 23307
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>"
Upvotes: 3