Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

48 lines (37 sloc) 0.784 kb
require 'rexml/document'
require 'rexml/streamlistener'
require 'Addon'
include REXML
class UiWoWNetListener
include REXML::StreamListener
def initialize(raw_xml, name)
@raw_xml = raw_xml
@current_element = nil
@current_addon = nil
@name = name
end
def get_addons
Document.parse_stream( @raw_xml, self)
@current_addon
end
def tag_start(name, attributes)
case name
when 'mod'
@current_addon = Addon.new
@current_addon.name = @name;
else
@current_element = name
end
end
def text(text)
case @current_element
when 'url'
if @current_addon then
@current_addon.url = text
index = text.rindex('/')
@current_addon.remote_version = text.slice(index + 1, text.length - (index))
end
end
@current_element = nil
end
end
Jump to Line
Something went wrong with that request. Please try again.