Class: MultiXml::Parsers::NokogiriSax::Handler Private

Inherits:
Nokogiri::XML::SAX::Document
  • Object
show all
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 that builds a hash tree while parsing

Instance Attribute Summary

Attributes included from SaxHandler

#result

Instance Method Summary collapse

Methods included from SaxHandler

#initialize_handler

Constructor Details

#initializeHandler

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



44
45
46
47
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 44

def initialize
  super
  initialize_handler
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

Parameters:

  • text (String)

    Text content



97
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 97

def characters(text) = append_text(text)

#end_documentvoid

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)



60
61
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 60

def end_document
end

#end_element(_name) ⇒ 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 an element

Parameters:

  • _name (String)

    Element name (unused)



88
89
90
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 88

def end_element(_name)
  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

Parameters:

  • message (String)

    Error message

Raises:

  • (Nokogiri::XML::SyntaxError)

    always



69
70
71
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 69

def error(message)
  raise ::Nokogiri::XML::SyntaxError, message
end

#start_documentvoid

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)



53
54
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 53

def start_document
end

#start_element(name, attrs = []) ⇒ 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 an element

Parameters:

  • name (String)

    Element name

  • attrs (Array) (defaults to: [])

    Element attributes as pairs



79
80
81
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 79

def start_element(name, attrs = [])
  handle_start_element(name, attrs)
end