Module: MultiXML::Parsers::Ox Private

Extended by:
MultiXML::Parser
Defined in:
lib/multi_xml/parsers/ox.rb

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 Ox library (fastest pure-Ruby parser)

Defined Under Namespace

Classes: Handler

Constant Summary collapse

ParseError =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Exception class raised on Ox parse failure

::Ox::ParseError

Class Method Summary collapse

Methods included from MultiXML::Parser

parse_error

Class Method Details

.parse(io, namespaces: :strip) ⇒ 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

Parameters:

  • io (IO)

    IO-like object containing XML

  • namespaces (Symbol) (defaults to: :strip)

    Namespace handling mode

Returns:

  • (Hash)

    Parsed XML as a hash



23
24
25
26
27
# File 'lib/multi_xml/parsers/ox.rb', line 23

def parse(io, namespaces: :strip)
  handler = Handler.new(namespaces)
  ::Ox.sax_parse(handler, io, convert_special: true, skip: :skip_return)
  handler.result
end