如何修复Ruby“没有这样的文件加载 - xsd / qname”错误?

时间:2012-11-28 03:34:29

标签: ruby-on-rails ruby exception ruby-1.9

我正在尝试运行FlightXML2 Ruby库来访问FlightAware API。 (图书馆的代码在这里:https://github.com/flightaware/flightxml2-client-ruby

当包含“require'FlightXML2.rb'”行的库文件时,会发生以下异常:

LoadError: no such file to load -- xsd/qname
    from /...PATH TO GEMS.../activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
    from /...PATH TO GEMS.../activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
    from /...PATH TO GEMS.../activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /...PATH TO GEMS.../activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
    from /...PATH TO GEMS.../lib/FlightXML2.rb:1:in `<top (required)>'
    from /...PATH TO GEMS.../activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
    from /...PATH TO GEMS.../activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
    from /...PATH TO GEMS.../activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /...PATH TO GEMS.../activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
    from (irb):2
    from /...PATH TO GEMS.../railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
    from /...PATH TO GEMS.../railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
    from /...PATH TO GEMS.../railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我怀疑这与编写库的Ruby 1.9和1.8之间的不兼容性有关。有没有办法使用Ruby 1.9?

2 个答案:

答案 0 :(得分:2)

为了让FlightXML2在我的Rails项目中运行,我必须安装'xmlparser'和'soap4r'gems并添加以下Gemfile:

gem 'xmlparser'
gem 'soap4r', :git => 'git://github.com/felipec/soap4r.git'

并添加以下兼容性创可贴:

require 'rexml/document'
require 'continuation'

class Symbol
  def sub(*args)
    to_s.sub(*args)
  end
end

答案 1 :(得分:1)

你需要的是


gem install xmlparser
gem install soap4r