From: not Date: 2007-09-02T02:20:11+09:00 Subject: Re: REXML element reading
error On Sat, 01 Sep 2007 04:57:57 +0900, 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
Not quite. It gives you the *first* text element. > The value in the XML file is below > 123 street
amstown
amserland
> > element = REXML::XPath.first(doc, '//Site') > > puts element.text #shows 123 Street > > How can i get the full data and once i have it i can remove the
I > cant find any information on this????? You can't find any specific info because there isn't anything specific. You have an XML element that contains a text node, an empty element named br, another text node, another empty element named br and another text node. In the XML world,
is a node like any other. The REXML::Element.texts method is what you are looking for: $ irb irb(main):001:0> require "rexml/document" => true irb(main):002:0> doc=REXML::Document.new("123 street
amstown
amserland
") => ... irb(main):003:0> doc.root.texts => ["123 street", "amstown", "amserland"] irb(main):004:0> doc.root.texts.join " " => "123 street amstown amserland" Enjoy!