Module: MultiXML::Parsers::NokogiriSax Private
- Extended by:
- MultiXML::Parser
- Defined in:
- lib/multi_xml/parsers/nokogiri_sax.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.
SAX-based parser using Nokogiri (faster for large documents)
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 Nokogiri parse failure
::Nokogiri::XML::SyntaxError
Class Method Summary collapse
-
.parse(xml, namespaces: :strip) ⇒ Hash
private
Parse XML from a string or IO object.
Methods included from MultiXML::Parser
Class Method Details
.parse(xml, 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 a string or IO object
26 27 28 29 30 31 32 33 |
# File 'lib/multi_xml/parsers/nokogiri_sax.rb', line 26 def parse(xml, namespaces: :strip) io = xml.respond_to?(:read) ? xml : StringIO.new(xml) return {} if io.eof? handler = Handler.new(namespaces) ::Nokogiri::XML::SAX::Parser.new(handler).parse(io) handler.result end |