Repository navigation
reject a partly filled optional xs:all group in SchemaTypeVisitorImpl - #170
Merged
Merged
Conversation
The ALL case of SchemaTypeVisitorImpl.visit only reported a missing required member when the group had not reached its minOccurs. For an xs:all with minOccurs='0' that is never the case, so once the group was entered any subset of its members validated, e.g. only the optional member. Treat a started all group as committed, as the sequence case already does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Differential run,
XmlObject.validate()vs the JDK Xerces validator, schema<xs:all minOccurs="0"> a, b, c? </xs:all>:How it was found: I was diffing XmlBeans against Xerces over content-model variants. Sequence, choice and
xs:allwithminOccurs="1"all agreed. Only an optional all group disagreed, and a<xs:group ref>to an all group withminOccurs="0"does the same.Observation: in the
ALLcase ofSchemaTypeVisitorImpl.visit, a missing required member is only an error while_curCount < _curMin. WithminOccurs="0"that is never true. Once the group is entered, any subset of its members is accepted. Required elements can be left out of an untrusted instance and it still validates, throughXmlObject.validate()andValidatingXMLStreamReader.Conclusion: a started all group is committed, as the
SEQUENCEcase already treats it (_processedChildCount != 0). The fix adds that condition. An absent optional group, complete groups in any order, andminOccurs="1"behave as before. After the fix thexs:alldisagreements are gone.OptionalAllGroupValidateTestfails before and passes after. The remaining localgradle testfailures (CompilationTests.partials,SaverTest.testLengthAssertion) also fail on trunk on Windows (CRLF).