gpt4 book ai didi

ruby-on-rails - 如何修复 Ruby "no such file to load -- xsd/qname"错误?

转载 作者:数据小太阳 更新时间:2023-10-29 08:00:51 27 4
gpt4 key购买 nike

我正在尝试运行 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.8 编写的。有没有办法使它与 Ruby 1.9 一起工作?

最佳答案

为了让 FlightXML2 在我的 Rails 项目中运行,我必须安装“xmlparser”和“soap4r”gem,并添加以下 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

关于ruby-on-rails - 如何修复 Ruby "no such file to load -- xsd/qname"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13597351/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com