Class: Moxml::Adapter::REXMLStreamBridge
- Inherits:
-
Object
- Object
- Moxml::Adapter::REXMLStreamBridge
show all
- Includes:
- SAX::NamespaceSplitter, REXML::StreamListener
- Defined in:
- lib/moxml/adapter/rexml.rb
Overview
Bridge between REXML StreamParser and Moxml SAX
StreamParser (rather than SAX2Parser) is used because SAX2Parser
normalizes plain "&#NN;" and "&#NN;" attribute literals to
the same raw string, which makes spec-correct decoding impossible
after the fact. StreamParser delivers attribute values in the
same decoded form as REXML's DOM.
Instance Method Summary
collapse
#split_attributes_and_namespaces
Constructor Details
Returns a new instance of REXMLStreamBridge.
688
689
690
|
# File 'lib/moxml/adapter/rexml.rb', line 688
def initialize(handler)
@handler = handler
end
|
Instance Method Details
#cdata(content) ⇒ Object
705
706
707
|
# File 'lib/moxml/adapter/rexml.rb', line 705
def cdata(content)
@handler.on_cdata(content)
end
|
709
710
711
|
# File 'lib/moxml/adapter/rexml.rb', line 709
def (text)
@handler.(text)
end
|
#instruction(target, data) ⇒ Object
713
714
715
|
# File 'lib/moxml/adapter/rexml.rb', line 713
def instruction(target, data)
@handler.on_processing_instruction(target, data || "")
end
|
#tag_end(name) ⇒ Object
697
698
699
|
# File 'lib/moxml/adapter/rexml.rb', line 697
def tag_end(name)
@handler.on_end_element(name)
end
|
#tag_start(name, attributes) ⇒ Object
692
693
694
695
|
# File 'lib/moxml/adapter/rexml.rb', line 692
def tag_start(name, attributes)
attr_hash, ns_hash = split_attributes_and_namespaces(attributes)
@handler.on_start_element(name, attr_hash, ns_hash)
end
|
#text(text) ⇒ Object
701
702
703
|
# File 'lib/moxml/adapter/rexml.rb', line 701
def text(text)
@handler.on_characters(text)
end
|