Sha256: 2982ced0d386b4df1b3424d0cc83c589068fbcf3b9568bc3e9d7997aeef35bbd

Contents?: true

Size: 681 Bytes

Versions: 125

Compression:

Stored size: 681 Bytes

Contents

require 'nokogiri' unless defined?(Nokogiri)
require 'multi_xml/parsers/libxml2_parser'

module MultiXml
  module Parsers
    module Nokogiri #:nodoc:
      include Libxml2Parser
      extend self

      def parse_error
        ::Nokogiri::XML::SyntaxError
      end

      def parse(xml)
        doc = ::Nokogiri::XML(xml)
        raise(doc.errors.first) unless doc.errors.empty?
        node_to_hash(doc.root)
      end

    private

      def each_child(node, &block)
        node.children.each(&block)
      end

      def each_attr(node, &block)
        node.attribute_nodes.each(&block)
      end

      def node_name(node)
        node.node_name
      end
    end
  end
end

Version data entries

125 entries across 99 versions & 6 rubygems

Version Path
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
study_line-0.2.7 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
study_line-0.2.6 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
study_line-0.2.5 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
study_line-0.2.4 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
study_line-0.2.3 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
study_line-0.2.2 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
study_line-0.2.1 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
study_line-0.2.0 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.10 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.9 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.8 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.7 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.6 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.5 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.4 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.3 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.2 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.1 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.2.0 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb