It's been a while since I've mucked around with REXML, but this works:
#####################
require "rexml/document"
include REXML
xml = REXML::Document.new("<LIVE365_STATION_INFO>
<STATION_BROADCASTER>username</STATION_BROADCASTER>
</LIVE365_STATION_INFO>")
xml.elements.each("*/STATION_BROADCASTER") {|e| puts e.text}
##################################
I'll recommend that you read the tutorial over and over. If I'm not
mistaken, there's a REXML mail list, or comp.lang.ruby is always a
good place to find information from people much more experienced than
me.
http://www.germane-software.com/software/rexml/docs/tutorial.html
On 6/5/07, Lana <[EMAIL PROTECTED]> wrote:
> Thank you for right direction, this helped me to get started:
> -----------------------------------------------------------------------------------------
> #includes
> require 'watir'
> require "rexml/document"
> include Watir
> include REXML
>
>
> doc = Document.new File.new("station.xml")
> root = doc.root
> puts root.elements["STATION_BROADCASTER"]
> =====
> result:
> <STATION_BROADCASTER>username</STATION_BROADCASTER>
> =========================================
> But I seems can't find how to get actual value of element
> 'STATION_BROADCASTER', as there is no attribute, any suggestions?
>
> this is my xml:
> <LIVE365_STATION_INFO>
> <STATION_BROADCASTER>username</STATION_BROADCASTER>
>
> Thank You,
> Lana
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general