Class: Moxml::Adapter::Leptris::LeptrisSAXBridge

Inherits:
Leptris::XML::SAX::Document
  • Object
show all
Includes:
SAX::NamespaceSplitter
Defined in:
lib/moxml/adapter/leptris/sax_bridge.rb

Overview

Bridge between the leptris SAX callbacks and Moxml::SAX::Handler.

Instance Method Summary collapse

Methods included from SAX::NamespaceSplitter

#split_attributes_and_namespaces

Constructor Details

#initialize(handler) ⇒ LeptrisSAXBridge

Returns a new instance of LeptrisSAXBridge.



12
13
14
15
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 12

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

Instance Method Details

#cdata_block(string) ⇒ Object



42
43
44
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 42

def cdata_block(string)
  @handler.on_cdata(string)
end

#characters(string) ⇒ Object



34
35
36
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 34

def characters(string)
  @handler.on_characters(string)
end

#comment(string) ⇒ Object



38
39
40
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 38

def comment(string)
  @handler.on_comment(string)
end

#end_documentObject



21
22
23
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 21

def end_document
  @handler.on_end_document
end

#end_element(name) ⇒ Object



30
31
32
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 30

def end_element(name)
  @handler.on_end_element(name)
end

#error(message, _line = 0, _column = 0) ⇒ Object



50
51
52
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 50

def error(message, _line = 0, _column = 0)
  @handler.on_error(Moxml::ParseError.new(message))
end

#processing_instruction(name, content) ⇒ Object



46
47
48
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 46

def processing_instruction(name, content)
  @handler.on_processing_instruction(name, content || "")
end

#start_documentObject



17
18
19
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 17

def start_document
  @handler.on_start_document
end

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



25
26
27
28
# File 'lib/moxml/adapter/leptris/sax_bridge.rb', line 25

def start_element(name, attrs = [])
  attr_hash, ns_hash = split_attributes_and_namespaces(attrs)
  @handler.on_start_element(name, attr_hash, ns_hash)
end