Saturday, 3 January 2015

Nokogiri builder escapes new lines



I'm trying to build a simple XML document like this:



builder = Nokogiri::XML::Builder.new
builder.document do |xml|
xml.title title
xml.content do
xml.cdata body_string
end
xml.pubDate item.xpath('./pubDate/text()').first.content.chomp
end


All of the new lines that go into content are escaped as \n. Is there a way I can force Nokogiri to leave the new lines intact?


No comments:

Post a Comment