Skip to content

Error with schema validation under JRuby #862

exupero opened this Issue Mar 13, 2013 · 8 comments

5 participants

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('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('saml20protocol_schema.xsd'))
RuntimeError: Could not parse document: src-resolve: Cannot resolve the name 'ds:Signature' to a(n) 'element declaration' component.
        from nokogiri/ `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/ `eval'
        from org/jruby/ `loop'
        from org/jruby/ `catch'
        from org/jruby/ `catch'
        from ~/.rvm/rubies/jruby-1.7.0/bin/irb:13:in `(root)'

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


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


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 commented Jun 3, 2013

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

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 commented Jun 5, 2013

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

pebrinic commented Jun 5, 2013

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

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.