From: Keith Fahlgren Date: 2007-09-01T05:18:48+09:00 Subject: Re: REXML element reading
error On 8/31/07, John Butler wrote: > When reading in the site element from my xml file using rexml it seems > to be chopping the rest of the text off after the first
> > The value in the XML file is below > 123 street
amstown
amserland
> > element = REXML::XPath.first(doc, '//Site') > I'd suggest using a bit more XPath, both text() and a each {} to iterate through the text nodes (which are distinct): $ irb -r rexml/document --prompt xmp a = REXML::Document.new("123 street
amstown
amserland
") # => ... REXML::XPath.first(a, '//Site').text # => "123 street" REXML::XPath.first(a, '//Site/text()').to_s # => "123 street" REXML::XPath.each(a, '//Site/text()') {|el| puts el} 123 street amstown amserland # => ["123 street", "amstown", "amserland"] HTH, Keith