I’ve just started working with REXML recently and have encountered a
small problem. After composing an XML document I want to output it to
file, currently I’m using xmlDoc.write theFile, problem is, the
resultant file does not have newlines after each element. When openning
the file in a text editor it comes in as one big line.
Any idea how to inject newline characters without a bunch of post
processing? Must be a pretty straightforward.
I’ve just started working with REXML recently and have encountered a small
problem. After composing an XML document I want to output it to file,
currently I’m using xmlDoc.write theFile, problem is, the resultant file does
not have newlines after each element. When openning the file in a text
editor it comes in as one big line.
Any idea how to inject newline characters without a bunch of post processing?
Must be a pretty straightforward.
if you do that it will not longer be valid xml. try
I’ve just started working with REXML recently and have encountered a
small problem. After composing an XML document I want to output it to
file, currently I’m using xmlDoc.write theFile, problem is, the
resultant file does not have newlines after each element. When
openning the file in a text editor it comes in as one big line.
IIRC, there is an parameter to xmlDoc.write. Try xmlDoc.write(STDOUT,
2).
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.