Sha256: bac8e9d17ab56747b2c80027d4619dec8b8ac5d145bd827e7e4df314fc747810

Contents?: true

Size: 1016 Bytes

Versions: 8

Compression:

Stored size: 1016 Bytes

Contents

module ROXML
  unless const_defined? 'XML_PARSER'
    begin
      require 'libxml'
      XML_PARSER = 'libxml' # :nodoc:
    rescue LoadError
      warn <<WARNING
ROXML is unable to locate libxml on your system, and so is falling back to
the much slower REXML.  It's best to check this out and get libxml working if possible.
WARNING
      XML_PARSER = 'rexml' # :nodoc:
    end
  end

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

  module XML
    class Node
      def self.from(data)
        case data
        when XML::Node
          data
        when XML::Document
          data.root
        when File, IO
          Parser.parse_io(data).root
        else
          if (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
end

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

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
Empact-roxml-2.5.1 lib/roxml/xml.rb
Empact-roxml-2.5.2 lib/roxml/xml.rb
Empact-roxml-2.5.3 lib/roxml/xml.rb
doxo-roxml-2.5.3 lib/roxml/xml.rb
roxml-2.5.1 lib/roxml/xml.rb
roxml-2.5.0 lib/roxml/xml.rb
roxml-2.5.3 lib/roxml/xml.rb
roxml-2.5.2 lib/roxml/xml.rb