Class: MultiXml::Parsers::LibxmlSax::Handler Private

Inherits:
Object
  • Object
show all
Includes:
LibXML::XML::SaxParser::Callbacks, SaxHandler
Defined in:
lib/multi_xml/parsers/libxml_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.

LibXML 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



48
49
50
# File 'lib/multi_xml/parsers/libxml_sax.rb', line 48

def initialize
  initialize_handler
end

Instance Method Details

#on_characters(text) ⇒ void Also known as: on_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



98
# File 'lib/multi_xml/parsers/libxml_sax.rb', line 98

def on_characters(text) = append_text(text)

#on_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)



63
64
# File 'lib/multi_xml/parsers/libxml_sax.rb', line 63

def on_end_document
end

#on_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)



89
90
91
# File 'lib/multi_xml/parsers/libxml_sax.rb', line 89

def on_end_element(_name)
  handle_end_element
end

#on_error(_error) ⇒ 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 (no-op, LibXML raises directly)

Parameters:

  • _error (String)

    Error message (unused)



71
72
# File 'lib/multi_xml/parsers/libxml_sax.rb', line 71

def on_error(_error)
end

#on_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)



56
57
# File 'lib/multi_xml/parsers/libxml_sax.rb', line 56

def on_start_document
end

#on_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 (Hash) (defaults to: {})

    Element attributes



80
81
82
# File 'lib/multi_xml/parsers/libxml_sax.rb', line 80

def on_start_element(name, attrs = {})
  handle_start_element(name, attrs)
end