class LiveJournal::Sync::CommentsXML::WithExpat::Parser
Attributes
comments[R]
maxid[R]
usermap[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/livejournal/comments-xml.rb, line 95 def initialize super @maxid = nil @cur_comment = nil @comments = {} @usermap = {} @content = nil end
Public Instance Methods
character(data)
click to toggle source
# File lib/livejournal/comments-xml.rb, line 124 def character(data) @content << data if @content end
endElement(name)
click to toggle source
# File lib/livejournal/comments-xml.rb, line 127 def endElement(name) return unless @content case name when 'maxid' @maxid = @content.to_i when 'date' @cur_comment.time = Time::xmlschema(@content) when 'subject' @cur_comment.subject = @content when 'body' @cur_comment.body = @content end @content = nil end
startElement(name, attrs)
click to toggle source
# File lib/livejournal/comments-xml.rb, line 103 def startElement(name, attrs) case name when 'maxid' @content = '' when 'comment' id = attrs['id'].to_i @cur_comment = @comments[id] || Comment.new @comments[id] = @cur_comment CommentsXML::load_comment_from_attrs(@cur_comment, attrs) when 'usermap' id = attrs['id'].to_i user = attrs['user'] @usermap[id] = user when 'date' @content = '' when 'subject' @content = '' when 'body' @content = '' end end