Skip to content

Error with schema validation under JRuby #862

Closed
exupero opened this Issue Mar 13, 2013 · 8 comments

5 participants

@exupero
exupero commented Mar 13, 2013

I'm having a problem with loading this schema under JRuby.

When I try it with MRI, all appears well:

$ rvm use ruby
$ irb
1.9.3p327 :001 > require 'nokogiri'
 => true 
1.9.3p327 :002 > Nokogiri::XML::Schema(IO.read('saml20protocol_schema.xsd'))
 => #<Nokogiri::XML::Schema:0x007fcb41020350> 

Whereas JRuby experiences the following error:

$ rvm use jruby
$ irb
irb(main):001:0> require 'nokogiri'
=> true
irb(main):002:0> Nokogiri::XML::Schema(IO.read('saml20protocol_schema.xsd'))
RuntimeError: Could not parse document: src-resolve: Cannot resolve the name 'ds:Signature' to a(n) 'element declaration' component.
        from nokogiri/XmlSchema.java:143:in `from_document'
        from ~/.rvm/gems/jruby-1.7.0/gems/nokogiri-1.5.6-java/lib/nokogiri/xml/schema.rb:37:in `new'
        from ~/.rvm/gems/jruby-1.7.0/gems/nokogiri-1.5.6-java/lib/nokogiri/xml/schema.rb:8:in `Schema'
        from (irb):2:in `evaluate'
        from org/jruby/RubyKernel.java:1065:in `eval'
        from org/jruby/RubyKernel.java:1390:in `loop'
        from org/jruby/RubyKernel.java:1173:in `catch'
        from org/jruby/RubyKernel.java:1173:in `catch'
        from ~/.rvm/rubies/jruby-1.7.0/bin/irb:13:in `(root)'
@tamersalama

I can confirm the issue here too (JRuby 1.7.3, Nokogiri 1.5.9 java, WinXP).

@tamersalama

Apparently, the issue might've been resolved in 1.6.0 branch two years ago but not yet released (here and c37d71e)

@tamersalama

This issue might be two folds:

  • Schema imports (which might've been fixed with this commit c37d71e)
  • Doctype vs DTD fixed with this commit patcheng@cd9824b

What I had to do is:

  • Download and use the 1.6.0 rc (includes the commit c37d71e)
  • Manually apply the modifications from the commit patcheng@cd9824b and rebuild the lib/nokogiri/nokogiri.jar file
@patcheng
patcheng commented Jun 3, 2013

#912 has the same test. And @injekt just merged the pull request. @exupero, maybe this issue can be closed?

@flavorjones
Sparkle Motion member

Can someone confirm whether this issue can be closed? I saw a lot of activity on a few other threads around this issue.

@exupero
exupero commented Jun 5, 2013

Thanks for all the work. I'll look into whether the fix works for me.

@pebrinic
pebrinic commented Jun 5, 2013

Would you guys be able to cut a new RC with this change? Thanks for fixing it!

@flavorjones
Sparkle Motion member

1.5.10 will be released later today with this fix.

@flavorjones flavorjones closed this Jun 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.