Skip to content

Nokogiri::XML::Schema#validate behaves differently in MRI and JRuby #1282

@ylansegal

Description

@ylansegal

When trying to re-use a Nokogiri::XML::Schema object for validating multiple Nokogiri::XML documents, the MRI and JRuby implementations behave differently. The JRuby implementation reports errors encountered in previous validation, while the MRI version does not.

Please see https://gist.github.com/ylansegal/eac88b27f5369b4f8ca7 for a recreation of the problem. It essentially validates a known good document, then a bad document and then a good document again against the same Schema object. In MRI, the last validation does not report errors (which is what I would expect). In JRuby it reports the errors from the previously validated document.

By the way, I encountered this error because the ruby-saml gem tries to memoize the schema to avoid reading from disk each time:

https://github.com/onelogin/ruby-saml/blob/master/lib/onelogin/ruby-saml/saml_message.rb#L26

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions