Module: MultiXml::Parsers::Oga Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
XML parser using the Oga library
Instance Method Summary collapse
-
#collect_children(node, node_hash) ⇒ void
private
Collect child nodes into a hash (Oga-specific implementation).
-
#parse(io) ⇒ Hash
private
Parse XML from an IO object.
-
#parse_error ⇒ Class
private
Get the parse error class for this parser.
Methods included from DomParser
Instance Method Details
#collect_children(node, node_hash) ⇒ 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.
Collect child nodes into a hash (Oga-specific implementation)
Oga uses different node types than Nokogiri/LibXML.
38 39 40 41 42 43 44 45 |
# File 'lib/multi_xml/parsers/oga.rb', line 38 def collect_children(node, node_hash) each_child(node) do |child| case child when ::Oga::XML::Element then node_to_hash(child, node_hash) when ::Oga::XML::Text, ::Oga::XML::Cdata then node_hash[TEXT_CONTENT_KEY] << child.text end end end |
#parse(io) ⇒ Hash
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.
Parse XML from an IO object
25 26 27 28 |
# File 'lib/multi_xml/parsers/oga.rb', line 25 def parse(io) doc = ::Oga.parse_xml(io) node_to_hash(doc.children.first) end |
#parse_error ⇒ Class
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.
Get the parse error class for this parser
17 |
# File 'lib/multi_xml/parsers/oga.rb', line 17 def parse_error = LL::ParserError |