Class: MultiXML::Parsers::NokogiriSax::Handler Private
- Inherits:
-
Nokogiri::XML::SAX::Document
- Object
- Nokogiri::XML::SAX::Document
- MultiXML::Parsers::NokogiriSax::Handler
- Includes:
- SaxHandler
- Defined in:
- lib/multi_xml/parsers/nokogiri_sax.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Nokogiri SAX handler.
Nokogiri always invokes start_element_namespace (even for documents
without namespaces — prefix/uri come through as nil). We don't define
start_element because it would never fire.
Instance Attribute Summary
Attributes included from SaxHandler
Instance Method Summary collapse
-
#characters(text) ⇒ void
(also: #cdata_block)
private
Handle character data.
-
#end_document ⇒ void
private
Handle end of document (no-op).
-
#end_element_namespace(_local, _prefix = nil, _uri = nil) ⇒ void
private
Handle end of a namespaced element.
-
#error(message) ⇒ void
private
Handle parse errors.
-
#initialize(mode) ⇒ Handler
constructor
private
Create a new SAX handler.
-
#start_document ⇒ void
private
Handle start of document (no-op).
-
#start_element_namespace(local, attrs = [], prefix = nil, _uri = nil, ns = []) ⇒ void
private
Handle start of a namespaced element.
Methods included from SaxHandler
Constructor Details
#initialize(mode) ⇒ Handler
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new SAX handler
50 51 52 53 |
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 50 def initialize(mode) super() initialize_handler(mode) end |
Instance Method Details
#characters(text) ⇒ void Also known as: cdata_block
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Handle character data
114 |
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 114 def characters(text) = append_text(text) |
#end_document ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Handle end of document (no-op)
66 67 |
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 66 def end_document end |
#end_element_namespace(_local, _prefix = nil, _uri = nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Handle end of a namespaced element
105 106 107 |
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 105 def end_element_namespace(_local, _prefix = nil, _uri = nil) handle_end_element end |
#error(message) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Handle parse errors
75 76 77 |
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 75 def error() raise ::Nokogiri::XML::SyntaxError, end |
#start_document ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Handle start of document (no-op)
59 60 |
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 59 def start_document end |
#start_element_namespace(local, attrs = [], prefix = nil, _uri = nil, ns = []) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Handle start of a namespaced element
Signature is fixed by the Nokogiri SAX protocol.
rubocop:disable Metrics/ParameterLists, Naming/MethodParameterName
91 92 93 94 95 |
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 91 def start_element_namespace(local, attrs = [], prefix = nil, _uri = nil, ns = []) ns_decls = ns.map { |p, u| [normalize(p), u] } attr_tuples = attrs.map { |a| [normalize(a.prefix), a.localname, a.value] } handle_start_element_ns(local, normalize(prefix), attr_tuples, ns_decls) end |