Class: Canon::Xml::Sax::NokogiriDriver

Inherits:
Nokogiri::XML::SAX::Document
  • Object
show all
Defined in:
lib/canon/xml/sax/nokogiri_driver.rb

Overview

Nokogiri SAX driver: the builder's protocol already matches Nokogiri::XML::SAX::Document, so every event is a pass-through.

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ NokogiriDriver

Returns a new instance of NokogiriDriver.



11
12
13
14
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 11

def initialize(builder)
  super()
  @builder = builder
end

Instance Method Details

#cdata_block(string) ⇒ Object



40
41
42
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 40

def cdata_block(string)
  @builder.cdata(string)
end

#characters(string) ⇒ Object



36
37
38
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 36

def characters(string)
  @builder.characters(string)
end

#comment(string) ⇒ Object



44
45
46
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 44

def comment(string)
  @builder.comment(string)
end

#end_element(name) ⇒ Object



32
33
34
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 32

def end_element(name)
  @builder.end_element(name)
end

#error(string) ⇒ Object



20
21
22
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 20

def error(string)
  @builder.error(string)
end

#parse(xml_string) ⇒ Object



16
17
18
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 16

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

#processing_instruction(name, content) ⇒ Object



48
49
50
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 48

def processing_instruction(name, content)
  @builder.processing_instruction(name, content)
end

#start_element(name, attrs = []) ⇒ Object



28
29
30
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 28

def start_element(name, attrs = [])
  @builder.start_element(name, attrs)
end

#warning(string) ⇒ Object



24
25
26
# File 'lib/canon/xml/sax/nokogiri_driver.rb', line 24

def warning(string)
  @builder.warning(string)
end