def parse(item)
if (e = item.elements['title']) && e.text
@title = e.text.unescape_html.toUTF8(@feed.encoding).html2text.rmWhiteSpace!
end
item.each_element('link') do |e|
if (h = e.attribute('href')) && h.value
@link = h.value
end
end
if e = item.elements['content'] || item.elements['summary']
if (e.attribute('mode') and e.attribute('mode').value == 'escaped') &&
e.text
@content = e.text.toUTF8(@feed.encoding).rmWhiteSpace!
else
@content = FeedParser::getcontent(e, @feed)
end
end
if (e = item.elements['issued'] || e = item.elements['created'] || e = item.elements['updated'] || e = item.elements['published']) && e.text
begin
@date = Time::xmlschema(e.text)
rescue
begin
@date = Time::rfc2822(e.text)
rescue
begin
@date = Time::parse(e.text)
rescue
@date = nil
end
end
end
end
item.each_element('author/name') do |e|
if e.text
@creators << e.text.unescape_html.toUTF8(@feed.encoding).rmWhiteSpace!
end
end
@creators << @feed.creator if @creators.empty? and @feed.creator
item.each_element('category') do |e|
if (h = e.attribute('term')) && h.value
if (l = e.attribute('label')) && l.value
cat = l.value
else
cat = h.value
end
@categories << cat.unescape_html.toUTF8(@feed.encoding).rmWhiteSpace!
end
end
end