Class: Moxml::Adapter::Nokogiri::NokogiriSAXBridge
- Inherits:
-
Nokogiri::XML::SAX::Document
- Object
- Nokogiri::XML::SAX::Document
- Moxml::Adapter::Nokogiri::NokogiriSAXBridge
show all
- Includes:
- SAX::NamespaceSplitter
- Defined in:
- lib/moxml/adapter/nokogiri.rb
Overview
Bridge between Nokogiri SAX and Moxml SAX
Translates Nokogiri::XML::SAX::Document events to Moxml::SAX::Handler events
Constant Summary
SAX::NamespaceSplitter::EMPTY_NAMESPACES
Instance Method Summary
collapse
#split_attributes_and_namespaces
Constructor Details
Returns a new instance of NokogiriSAXBridge.
546
547
548
549
|
# File 'lib/moxml/adapter/nokogiri.rb', line 546
def initialize(handler)
super()
@handler = handler
end
|
Instance Method Details
#cdata_block(string) ⇒ Object
576
577
578
|
# File 'lib/moxml/adapter/nokogiri.rb', line 576
def cdata_block(string)
@handler.on_cdata(string)
end
|
#characters(string) ⇒ Object
572
573
574
|
# File 'lib/moxml/adapter/nokogiri.rb', line 572
def characters(string)
@handler.on_characters(string)
end
|
580
581
582
|
# File 'lib/moxml/adapter/nokogiri.rb', line 580
def (string)
@handler.(string)
end
|
#end_document ⇒ Object
557
558
559
|
# File 'lib/moxml/adapter/nokogiri.rb', line 557
def end_document
@handler.on_end_document
end
|
#end_element(name) ⇒ Object
568
569
570
|
# File 'lib/moxml/adapter/nokogiri.rb', line 568
def end_element(name)
@handler.on_end_element(name)
end
|
#error(string) ⇒ Object
588
589
590
|
# File 'lib/moxml/adapter/nokogiri.rb', line 588
def error(string)
@handler.on_error(Moxml::ParseError.new(string))
end
|
#processing_instruction(target, data) ⇒ Object
584
585
586
|
# File 'lib/moxml/adapter/nokogiri.rb', line 584
def processing_instruction(target, data)
@handler.on_processing_instruction(target, data || "")
end
|
#start_document ⇒ Object
Map Nokogiri events to Moxml events
553
554
555
|
# File 'lib/moxml/adapter/nokogiri.rb', line 553
def start_document
@handler.on_start_document
end
|
#start_element(name, attributes = []) ⇒ Object
561
562
563
564
565
566
|
# File 'lib/moxml/adapter/nokogiri.rb', line 561
def start_element(name, attributes = [])
attr_hash, ns_hash = split_attributes_and_namespaces(attributes) do |v|
Moxml::Adapter::Base.decode_entities(v)
end
@handler.on_start_element(name, attr_hash, ns_hash)
end
|
#warning(string) ⇒ Object
592
593
594
|
# File 'lib/moxml/adapter/nokogiri.rb', line 592
def warning(string)
@handler.on_warning(string)
end
|