Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
how to convert xml to text in ruby
Shweta Kadam
3/5/2008 5:27:00 AM
how to convert xml to text in ruby
1 Answer
Phlip
3/5/2008 5:40:00 AM
0
> how to convert xml to text in ruby
Hpricot, Libxml, or REXML?
Here's 'inner_text' in REXML:
def inner_text(interstitial = '')
return self.each_element( './/text()' ){}.join(interstitial)
end
It strips out all tags & attributes, and returns only the textual contents
between them.
( via
http://assertxpath.rubyforge.org/classes/REXML/Element.ht...
)
Replace 'self' with a REXML node to get cooking...
--
Phlip
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
how to convert xml to text in ruby
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password