Class: Moxml::Adapter::Libxml::LibXMLSAXBridge
- Inherits:
-
Object
- Object
- Moxml::Adapter::Libxml::LibXMLSAXBridge
show all
- Includes:
- LibXML::XML::SaxParser::Callbacks, SAX::NamespaceSplitter
- Defined in:
- lib/moxml/adapter/libxml.rb
Overview
Bridge between LibXML SAX and Moxml SAX
Translates LibXML::XML::SaxParser events to Moxml::SAX::Handler events
Instance Method Summary
collapse
#split_attributes_and_namespaces
Constructor Details
Returns a new instance of LibXMLSAXBridge.
1677
1678
1679
|
# File 'lib/moxml/adapter/libxml.rb', line 1677
def initialize(handler)
@handler = handler
end
|
Instance Method Details
#on_cdata_block(content) ⇒ Object
1704
1705
1706
|
# File 'lib/moxml/adapter/libxml.rb', line 1704
def on_cdata_block(content)
@handler.on_cdata(content)
end
|
#on_characters(chars) ⇒ Object
1700
1701
1702
|
# File 'lib/moxml/adapter/libxml.rb', line 1700
def on_characters(chars)
@handler.on_characters(chars)
end
|
1708
1709
1710
|
# File 'lib/moxml/adapter/libxml.rb', line 1708
def (msg)
@handler.(msg)
end
|
#on_end_document ⇒ Object
1687
1688
1689
|
# File 'lib/moxml/adapter/libxml.rb', line 1687
def on_end_document
@handler.on_end_document
end
|
#on_end_element(name) ⇒ Object
1696
1697
1698
|
# File 'lib/moxml/adapter/libxml.rb', line 1696
def on_end_element(name)
@handler.on_end_element(name.to_s)
end
|
#on_error(msg) ⇒ Object
1716
1717
1718
|
# File 'lib/moxml/adapter/libxml.rb', line 1716
def on_error(msg)
@handler.on_error(Moxml::ParseError.new(msg))
end
|
#on_processing_instruction(target, data) ⇒ Object
1712
1713
1714
|
# File 'lib/moxml/adapter/libxml.rb', line 1712
def on_processing_instruction(target, data)
@handler.on_processing_instruction(target, data || "")
end
|
#on_start_document ⇒ Object
Map LibXML events to Moxml events
1683
1684
1685
|
# File 'lib/moxml/adapter/libxml.rb', line 1683
def on_start_document
@handler.on_start_document
end
|
#on_start_element(name, attributes) ⇒ Object
1691
1692
1693
1694
|
# File 'lib/moxml/adapter/libxml.rb', line 1691
def on_start_element(name, attributes)
attr_hash, ns_hash = split_attributes_and_namespaces(attributes)
@handler.on_start_element(name.to_s, attr_hash, ns_hash)
end
|