Turn Nokogiri XML object to string without using .text
html, nokogiri, ruby
Solution
You want `.inner_html` instead of `.text`.
Problem
I have an object which is a child of a `< td >` tag. The class is `ctext` and the relevant data is within the `< b >` tag.tag I have selected the node using: ``` td.css(".ctext b") ``` and it seems to work. I get a result of something like: ``` < b >Flying< br >< br >At the beginning of each combat, choose first strike, vigilance, or lifelink. Creatures you control gain that ability until end of turn.< /b > ``` If I use: ``` td.css(".ctext b").text ``` to convert it to a string, I get: ``` FlyingAt the beginning of each combat, choose first strike, vigilance, or lifelink. Creatures you control gain that ability until end of turn. ``` What I need is to be able to convert the `td.css(".ctext b")`, which I think is a Nokogiri xml node to string without stripping the HTML tags. I need to keep the `< br >`s.