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.
1664
1665
1666
|
# File 'lib/moxml/adapter/libxml.rb', line 1664
def initialize(handler)
@handler = handler
end
|
Instance Method Details
#on_cdata_block(content) ⇒ Object
1691
1692
1693
|
# File 'lib/moxml/adapter/libxml.rb', line 1691
def on_cdata_block(content)
@handler.on_cdata(content)
end
|
#on_characters(chars) ⇒ Object
1687
1688
1689
|
# File 'lib/moxml/adapter/libxml.rb', line 1687
def on_characters(chars)
@handler.on_characters(chars)
end
|
1695
1696
1697
|
# File 'lib/moxml/adapter/libxml.rb', line 1695
def (msg)
@handler.(msg)
end
|
#on_end_document ⇒ Object
1674
1675
1676
|
# File 'lib/moxml/adapter/libxml.rb', line 1674
def on_end_document
@handler.on_end_document
end
|
#on_end_element(name) ⇒ Object
1683
1684
1685
|
# File 'lib/moxml/adapter/libxml.rb', line 1683
def on_end_element(name)
@handler.on_end_element(name.to_s)
end
|
#on_error(msg) ⇒ Object
1703
1704
1705
|
# File 'lib/moxml/adapter/libxml.rb', line 1703
def on_error(msg)
@handler.on_error(Moxml::ParseError.new(msg))
end
|
#on_processing_instruction(target, data) ⇒ Object
1699
1700
1701
|
# File 'lib/moxml/adapter/libxml.rb', line 1699
def on_processing_instruction(target, data)
@handler.on_processing_instruction(target, data || "")
end
|
#on_start_document ⇒ Object
Map LibXML events to Moxml events
1670
1671
1672
|
# File 'lib/moxml/adapter/libxml.rb', line 1670
def on_start_document
@handler.on_start_document
end
|
#on_start_element(name, attributes) ⇒ Object
1678
1679
1680
1681
|
# File 'lib/moxml/adapter/libxml.rb', line 1678
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
|