Does REXML add spaces to comments?

P

phlip2005

Rubistas:

I'm using REXML to read and write XML too often.

Whenever REXML saves a comment, it adds linefeeds to it. Because I
write too often, these are stacking up. Is this my fault? I tried
various doc.write(f, x) options for the indentation levels.

Ruby 1.8.2 (from the Pragmatic Programmers' way cool installer).
 
J

James Britt

Rubistas:

I'm using REXML to read and write XML too often.

Whenever REXML saves a comment, it adds linefeeds to it. Because I
write too often, these are stacking up. Is this my fault? I tried
various doc.write(f, x) options for the indentation levels.


Doesn't seem that way for me:


#--------
require 'rexml/document'
doc = REXML::Document.new( "<foo>Text</foo>" )
doc.root << REXML::Comment.new( 'My Comment')
puts doc # <foo>Text<!--My Comment--></foo>
#--------


This is using

ruby 1.8.2 (2004-11-06) [i386-mswin32]

on Win2K
Ruby 1.8.2 (from the Pragmatic Programmers' way cool installer).

I believe this is Curt Hibbs' work, now referred to as the "One-click
Installer."


James
 
P

Phlip

#--------
require 'rexml/document'
doc = REXML::Document.new( "<foo>Text</foo>" )
doc.root << REXML::Comment.new( 'My Comment')
puts doc # <foo>Text<!--My Comment--></foo>
#--------

I cannot reproduce the problem using a 4 line program like that, with a copy
of the production XML that causes the problem. Thanks for trying. I have to
look closer at the production then...
 
S

Stefan Lang

Am Mittwoch, 1. Dezember 2004 19:32 schrieb (e-mail address removed):
Rubistas:

I'm using REXML to read and write XML too often.

Whenever REXML saves a comment, it adds linefeeds to it. Because I
write too often, these are stacking up. Is this my fault? I tried
various doc.write(f, x) options for the indentation levels.

Ruby 1.8.2 (from the Pragmatic Programmers' way cool installer).

I have the same problem: Read document and write it
out again with (usually) doc.write(file, 0).
This adds some (at least one) linefeeds to previously existing ones.

Ruby version: ruby 1.8.2 (2004-11-06) [i686-linux]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,163
Messages
2,570,897
Members
47,434
Latest member
TobiasLoan

Latest Threads

Top