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.



1180
1181
1182
1183
# File 'lib/moxml/adapter/leptris.rb', line 1180

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

Instance Method Details

#cdata_block(string) ⇒ Object



1210
1211
1212
# File 'lib/moxml/adapter/leptris.rb', line 1210

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

#characters(string) ⇒ Object



1202
1203
1204
# File 'lib/moxml/adapter/leptris.rb', line 1202

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

#comment(string) ⇒ Object



1206
1207
1208
# File 'lib/moxml/adapter/leptris.rb', line 1206

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

#end_documentObject



1189
1190
1191
# File 'lib/moxml/adapter/leptris.rb', line 1189

def end_document
  @handler.on_end_document
end

#end_element(name) ⇒ Object



1198
1199
1200
# File 'lib/moxml/adapter/leptris.rb', line 1198

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

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



1218
1219
1220
# File 'lib/moxml/adapter/leptris.rb', line 1218

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

#processing_instruction(name, content) ⇒ Object



1214
1215
1216
# File 'lib/moxml/adapter/leptris.rb', line 1214

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

#start_documentObject



1185
1186
1187
# File 'lib/moxml/adapter/leptris.rb', line 1185

def start_document
  @handler.on_start_document
end

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



1193
1194
1195
1196
# File 'lib/moxml/adapter/leptris.rb', line 1193

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