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-0.1.99 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.98 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.97 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.96 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.95 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.94 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.93 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.91 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.90 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.89 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.88 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.87 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.86 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.85 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.84 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.83 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.82 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.81 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.80 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb
harbr-0.1.79 vendor/bundle/ruby/3.2.0/gems/multi_xml-0.6.0/lib/multi_xml/parsers/nokogiri.rb