Nokogiri XML Builder Newlines -


nokogiri xml builder randomly adding new lines outputted xml.

how can nokogiri output new line after each tag.

for example, output getting

<books>    <book>       <title>foobar</title><author>me       </author>    <book> </books> 

but want

<books>    <book>       <title>foobar</title>       <author>me</author>    <book> </books> 

what wrong!!!!???

the problem in code, but, because said "no, can't. need explanation." can't fix it.

this generates output want. you'll need figure out how make apply situation:

require 'nokogiri'  builder = nokogiri::xml::builder.new |xml|   xml.books {     xml.book {       xml.title { xml.text 'foobar' }       xml.author { xml.text 'me' }     }   } end  puts builder.to_xml # >> <?xml version="1.0"?> # >> <books> # >>   <book> # >>     <title>foobar</title> # >>     <author>me</author> # >>   </book> # >> </books> 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -