def FeedParser::getcontent(e, feed = nil)
encoding = feed ? feed.encoding : 'utf-8'
children = e.children.reject do |i|
i.class == REXML::Text and i.to_s.chomp == ''
end
if children.length > 1
s = ''
children.each do |c|
s += c.to_s if c.class != REXML::Comment
end
return s.toUTF8(encoding).rmWhiteSpace!.text2html(feed)
elsif children.length == 1
c = children[0]
if c.class == REXML::Text
return e.text.toUTF8(encoding).rmWhiteSpace!.text2html(feed)
elsif c.class == REXML::CData
return c.to_s.toUTF8(encoding).rmWhiteSpace!.text2html(feed)
elsif c.class == REXML::Element
return getcontent(c, feed)
elsif c.text
return c.text.toUTF8(encoding).text2html(feed)
end
end
end