-
-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nokogiri::XML::Schema#validate behaves differently in MRI and JRuby #1282
Labels
Milestone
Comments
Thanks for reporting this. Someone will take a look! |
This was referenced May 7, 2015
zfletch
added a commit
to perseids-tools/epi-doc-validator-rb
that referenced
this issue
Mar 9, 2021
There is a bug in Nokogiri (sparklemotion/nokogiri#1282) that causes `Nokogiri::XML::RelaxNG#validate` in JRuby to add errors every time it's called. To fix this, create a new instance of `Nokogiri::XML::RelaxNG` every time. To lessen the impact on the library's performance, use `from_document` and cache the parsed XML.
Just a note that I've started a branch to clean up XML::Schema behavior and this is being worked on. |
👏 👏 Thank you @flavorjones. Better late than never! |
flavorjones
added a commit
that referenced
this issue
Aug 24, 2021
Closed
Closed
flavorjones
added a commit
that referenced
this issue
Nov 22, 2021
flavorjones
added a commit
that referenced
this issue
Jun 24, 2024
flavorjones
added a commit
that referenced
this issue
Jun 24, 2024
See #3258 which should fix this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When trying to re-use a
Nokogiri::XML::Schema
object for validating multipleNokogiri::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
The text was updated successfully, but these errors were encountered: