Sha256: 7fcccef20faea059c552e34a2bfa9ef5985e0bb00ab8ec1b2d7acacd3ff60fff

Contents?: true

Size: 656 Bytes

Versions: 53

Compression:

Stored size: 656 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 if doc.errors.length > 0
        node_to_hash(doc.root)
      end

      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

53 entries across 52 versions & 8 rubygems

Version Path
plyom_user-0.0.4 vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/nokogiri.rb
plyom_user-0.0.3 vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/nokogiri.rb
plyom_user-0.0.2 vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/nokogiri.rb
multi_xml-0.5.5 lib/multi_xml/parsers/nokogiri.rb
multi_xml-0.5.4 lib/multi_xml/parsers/nokogiri.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/multi_xml-0.5.3/lib/multi_xml/parsers/nokogiri.rb
multi_xml-0.5.3 lib/multi_xml/parsers/nokogiri.rb
multi_xml-0.5.2 lib/multi_xml/parsers/nokogiri.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.1/lib/multi_xml/parsers/nokogiri.rb
multi_xml-0.5.1 lib/multi_xml/parsers/nokogiri.rb
multi_xml-0.5.0 lib/multi_xml/parsers/nokogiri.rb
multi_xml-0.4.4 lib/multi_xml/parsers/nokogiri.rb
multi_xml-0.4.3 lib/multi_xml/parsers/nokogiri.rb