Class: Fog::XenServer::NokogiriStreamParser

Inherits:
XMLRPC::XMLParser::AbstractStreamParser
  • Object
show all
Defined in:
lib/fog/xenserver/core.rb

Instance Method Summary collapse

Constructor Details

#initializeNokogiriStreamParser

Returns a new instance of NokogiriStreamParser.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/fog/xenserver/core.rb', line 73

def initialize
  require 'nokogiri/xml/sax/document'
  require 'nokogiri/xml/sax/parser'

  @parser_class = Class.new(Nokogiri::XML::SAX::Document) do

    include XMLRPC::XMLParser::StreamParserMixin

    alias_method :start_element, :startElement
    alias_method :end_element,   :endElement
    alias_method :characters,    :character
    alias_method :cdata_block,   :character

    def parse(str)
      Nokogiri::XML::SAX::Parser.new(self).parse(str)
    end

  end
end