Class: FeedParser::LibXML::StrictFeedParser

Inherits:
Object
  • Object
show all
Defined in:
lib/rfeedparser/libxml_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(baseuri, baselang) ⇒ StrictFeedParser

Returns a new instance of StrictFeedParser.



9
10
11
# File 'lib/rfeedparser/libxml_parser.rb', line 9

def initialize(baseuri, baselang)
  @handler = StrictFeedParserHandler.new(baseuri, baselang, 'utf-8')
end

Instance Attribute Details

#handlerObject (readonly)

Returns the value of attribute handler.



7
8
9
# File 'lib/rfeedparser/libxml_parser.rb', line 7

def handler
  @handler
end

Instance Method Details

#parse(data) ⇒ Object



13
14
15
16
17
18
# File 'lib/rfeedparser/libxml_parser.rb', line 13

def parse(data)
  saxparser = ::LibXML::XML::SaxParser.new
  saxparser.callbacks = @handler
  saxparser.string = data
  saxparser.parse
end