pjfanning commented on PR #134:
URL: https://github.com/apache/poi-xmlbeans/pull/134#issuecomment-6211538357

   Thanks for this. The `t != null` guards look right, and I've kept them. I 
pushed one follow-up commit (63c5a6e9) because of a problem the second test 
uncovered.
   
   **Problem:** a complex type with union simple content gets the content 
type's simple variety and union members (`StscComplexTypeResolver`). This means 
`isAssignableFrom` took the union-member branch for `ct` too, and 
`ct.isAssignableFrom(xs:int)` returned true. With the null guards in place, 
`unionMemberSubstitutionUnderTypeBlock` stopped throwing, but the document then 
**validated successfully**. A simple type was accepted as `xsi:type` for a 
complex type, where the spec requires cvc-elt.4.3a. The test's 
`assertDoesNotThrow` didn't catch this.
   
   **Changes:**
   - `SchemaTypeImpl.isAssignableFrom`: the union-member branch (Type 
Derivation OK (Simple) 2.2.4) now applies only when the type is a simple type: 
`isSimpleType() && getSimpleVariety() == UNION`.
   - The second test is renamed 
`simpleTypeSubstitutionForUnionContentComplexType`. It now asserts that 
`validate()` returns false with a single `cvc-elt.4.3a` error. I also removed 
the unused `assertDoesNotThrow` import.
   
   The real union case (test 1) still validates, and it still relies on your 
null guard in the block walk.
   


-- 
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