aizu-m opened a new pull request, #170:
URL: https://github.com/apache/poi-xmlbeans/pull/170

   Differential run, `XmlObject.validate()` vs the JDK Xerces validator, schema 
`<xs:all minOccurs="0"> a, b, c? </xs:all>`:
   
       <r><a>1</a></r>
            XB: VALID
            XE: INVALID cvc-complex-type.2.4.b: The content of element 'r' is 
not complete. One of '{"urn:t":b, "urn:t":c}' is expected.
       <r><c/></r>
            XB: VALID
            XE: INVALID cvc-complex-type.2.4.b: The content of element 'r' is 
not complete. One of '{"urn:t":a, "urn:t":b}' is expected.
   
   How it was found: I was diffing XmlBeans against Xerces over content-model 
variants. Sequence, choice and `xs:all` with `minOccurs="1"` all agreed. Only 
an optional all group disagreed, and a `<xs:group ref>` to an all group with 
`minOccurs="0"` does the same.
   
   Observation: in the `ALL` case of `SchemaTypeVisitorImpl.visit`, a missing 
required member is only an error while `_curCount < _curMin`. With 
`minOccurs="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, through `XmlObject.validate()` and 
`ValidatingXMLStreamReader`.
   
   Conclusion: a started all group is committed, as the `SEQUENCE` case already 
treats it (`_processedChildCount != 0`). The fix adds that condition. An absent 
optional group, complete groups in any order, and `minOccurs="1"` behave as 
before. After the fix the `xs:all` disagreements are gone. 
`OptionalAllGroupValidateTest` fails before and passes after. The remaining 
local `gradle test` failures (`CompilationTests.partials`, 
`SaverTest.testLengthAssertion`) also fail on trunk on Windows (CRLF).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to