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

Inherits:
Leptris::XML::SAX::Document
  • Object
show all
Includes:
SAX::NamespaceSplitter
Defined in:
lib/moxml/adapter/leptris.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.



1128
1129
1130
1131
# File 'lib/moxml/adapter/leptris.rb', line 1128

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

Instance Method Details

#cdata_block(string) ⇒ Object



1158
1159
1160
# File 'lib/moxml/adapter/leptris.rb', line 1158

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

#characters(string) ⇒ Object



1150
1151
1152
# File 'lib/moxml/adapter/leptris.rb', line 1150

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

#comment(string) ⇒ Object



1154
1155
1156
# File 'lib/moxml/adapter/leptris.rb', line 1154

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

#end_documentObject



1137
1138
1139
# File 'lib/moxml/adapter/leptris.rb', line 1137

def end_document
  @handler.on_end_document
end

#end_element(name) ⇒ Object



1146
1147
1148
# File 'lib/moxml/adapter/leptris.rb', line 1146

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

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



1166
1167
1168
# File 'lib/moxml/adapter/leptris.rb', line 1166

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

#processing_instruction(name, content) ⇒ Object



1162
1163
1164
# File 'lib/moxml/adapter/leptris.rb', line 1162

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

#start_documentObject



1133
1134
1135
# File 'lib/moxml/adapter/leptris.rb', line 1133

def start_document
  @handler.on_start_document
end

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



1141
1142
1143
1144
# File 'lib/moxml/adapter/leptris.rb', line 1141

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