From: Markus Jais Date: 2001-12-07T08:14:08+09:00 Subject: [ruby-talk:27765] REXML: question on whitespace hello I have a question on whitespace in documents generated with REXML I have the following code: ---- require "rexml/document" include REXML def make_language(name, creator, is_oop) el = Element.new("language") name_el = Element.new("name") name_el.text = name creator_el = Element.new("creator") creator_el.text = creator el << name_el << creator_el el.add_attribute( Attribute.new("oop", is_oop)) return el end doc = Document.new("") rt = doc.root lang1 = make_language("Ruby", "Yukihiro Matsumoto", "yes") lang2 = make_language("Python", "Guido van Rossum", "yes") rt << lang1 rt << lang2 doc.write(File.new("lang.xml", "w")) --- this produces the following output: Ruby Yukihiro Matsumoto Python Guido van Rossum / I want the output to be formated this way! now I have this code: --- require "rexml/document" include REXML doc = Document.new(File.new("lang.xml")) doc.elements.each("//language/*") { |element| if element.name == "name" print element.text.strip, " : " elsif element.name == "creator" print element.text.strip, "\n" end } --- element.text returns the text of the element including '\n' is there a way to ignore all whitespace, so that I do not have to call "strip"????? in the methods element#text, no whitespace is removed according to the sources. any hints are welcome! markus