Module: MultiSAX::Callbacks

Defined in:
lib/multisax.rb

Overview

MultiSAX callbacks. MultiSAX::SAX listener should include this module.

Instance Method Summary collapse

Instance Method Details

#sax_cdata(text) ⇒ Object

CDATA



300
# File 'lib/multisax.rb', line 300

def sax_cdata(text) end

#sax_comment(text) ⇒ Object

Comment



298
# File 'lib/multisax.rb', line 298

def sax_comment(text) end

#sax_end_element_namespace(name, prefix = nil, uri = nil) ⇒ Object

Cited from Nokogiri



289
290
291
292
# File 'lib/multisax.rb', line 289

def sax_end_element_namespace name, prefix = nil, uri = nil
  # Deal with SAX v1 interface
  sax_tag_end [prefix, name].compact.join(':')
end

#sax_start_element_namespace_libxml(name, attrs, prefix = nil, uri = nil, ns = []) ⇒ Object

libxml namespace handler



275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/multisax.rb', line 275

def sax_start_element_namespace_libxml name, attrs, prefix = nil, uri = nil, ns = []
      # Deal with SAX v1 interface
      name = [prefix, name].compact.join(':')
      # modified in 0.0.2
      attributes = {}
      ns.each{|ns_prefix,ns_uri|
        attributes[['xmlns', ns_prefix].compact.join(':')]=ns_uri
      }
      attrs.each{|k,v|
        attributes[k]=v
      }
      sax_tag_start name, attributes
end

#sax_start_element_namespace_nokogiri(name, attrs = [], prefix = nil, uri = nil, ns = []) ⇒ Object

Cited from Nokogiri to convert Nokogiri::XML::SAX::Document into module.

https://github.com/sparklemotion/nokogiri/blob/master/lib/nokogiri/xml/sax/document.rb


261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/multisax.rb', line 261

def sax_start_element_namespace_nokogiri name, attrs = [], prefix = nil, uri = nil, ns = []
      # Deal with SAX v1 interface
      name = [prefix, name].compact.join(':')
      # modified in 0.0.2
      attributes = {}
      ns.each{|ns_prefix,ns_uri|
        attributes[['xmlns', ns_prefix].compact.join(':')]=ns_uri
      }
      attrs.each{|attr|
        attributes[[attr.prefix, attr.localname].compact.join(':')]=attr.value
      }
      sax_tag_start name, attributes
end

#sax_tag_end(tag) ⇒ Object

End of tag



296
# File 'lib/multisax.rb', line 296

def sax_tag_end(tag) end

#sax_tag_start(tag, attrs) ⇒ Object

Start of tag



294
# File 'lib/multisax.rb', line 294

def sax_tag_start(tag,attrs) end

#sax_text(text) ⇒ Object

Text



302
# File 'lib/multisax.rb', line 302

def sax_text(text) end

#sax_xmldecl(version, encoding, standalone) ⇒ Object

XML declaration (not available if parser is :libxml)



304
# File 'lib/multisax.rb', line 304

def sax_xmldecl(version,encoding,standalone) end