Sha256: bf29e721cff8c74596cbd90f659f80ae40e90b59bbeca05e83c6b10adaf3d88c

Contents?: true

Size: 765 Bytes

Versions: 4

Compression:

Stored size: 765 Bytes

Contents

module ROXML
  unless const_defined? 'XML_PARSER'
    begin
      require 'libxml'
      XML_PARSER = 'libxml' # :nodoc:
    rescue LoadError
      XML_PARSER = 'rexml' # :nodoc:
    end
  end

  require File.join(File.dirname(__FILE__), 'xml/parsers', XML_PARSER)

  module XML
    class Node
      def self.from(data)
        if data.is_a?(XML::Node)
          data
        elsif data.is_a?(File) || data.is_a?(IO)
          Parser.parse_io(data).root
        elsif (defined?(URI) && data.is_a?(URI::Generic)) ||
              (defined?(Pathname) && data.is_a?(Pathname))
          Parser.parse_file(data.to_s).root
        else
          Parser.parse(data).root
        end
      end
    end
  end
end

require File.join(File.dirname(__FILE__), 'xml/references')

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
Empact-roxml-2.4.2 lib/roxml/xml.rb
Empact-roxml-2.4.3 lib/roxml/xml.rb
roxml-2.4.2 lib/roxml/xml.rb
roxml-2.4.3 lib/roxml/xml.rb