如何修复Ruby“没有此类文件可加载-xsd/qname"错误? [英] How to fix a Ruby "no such file to load -- xsd/qname" error?

查看:63
本文介绍了如何修复Ruby“没有此类文件可加载-xsd/qname"错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行FlightXML2 Ruby库以访问FlightAware API.(该库的代码在这里: https://github.com/flightaware/flightxml2-client-ruby )

I'm trying to run the FlightXML2 Ruby library for accessing the FlightAware API. (The library's code is here: https://github.com/flightaware/flightxml2-client-ruby)

在库文件中包含"require'FlightXML2.rb'"行时,会发生以下异常:

When including the library file with the line "require 'FlightXML2.rb'", the following exception occurs:

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兼容?

I suspect this has to do with incompatibility between Ruby 1.9 and 1.8, for which the library was written. Is there a way to make this work with Ruby 1.9?

推荐答案

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

In order to make FlightXML2 run in my Rails project, I had to install the 'xmlparser' and 'soap4r' gems with the following Gemfile additions:

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

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

And also add the following compatibility band-aids:

require 'rexml/document'
require 'continuation'

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

这篇关于如何修复Ruby“没有此类文件可加载-xsd/qname"错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆