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

   Differential run of `XmlObject.validate()` against the JDK Xerces validator, 
same schema and instances:
   
       <xs:simpleType name='idList'><xs:list itemType='xs:ID'/></xs:simpleType>
       <xs:simpleType name='idUnion'><xs:union memberTypes='xs:int 
xs:ID'/></xs:simpleType>
   
       <t:ids>a b</t:ids><t:id>a</t:id>       xmlbeans: valid    xerces: 
cvc-id.2 multiple occurrences of ID value 'a'
       <t:idu>a</t:idu><t:idu>a</t:idu>       xmlbeans: valid    xerces: 
cvc-id.2 multiple occurrences of ID value 'a'
       <t:refs>a zz</t:refs><t:id>a</t:id>    xmlbeans: valid    xerces: 
cvc-id.1 no ID/IDREF binding for IDREF 'zz'
       <t:refu>zz</t:refu>                    xmlbeans: valid    xerces: 
cvc-id.1 no ID/IDREF binding for IDREF 'zz'
   
   Found while probing the ID/IDREF table with ID and IDREF values reached 
through list and union types. 16 disagreements, all in the accept direction. 
`ValidatingXMLStreamReader` gives the same results, it shares the engine.
   
   `IdentityConstraint.IdState.handleValue` and `IdRefState.handleValue` only 
enter a value when its type is assignable to xs:ID, xs:IDREF or xs:IDREFS. A 
list whose items are IDs, a union with an ID member, or a list of such unions 
is not. The value never reaches the table, so duplicate IDs and dangling 
references validate clean. XML Schema 1.1 Part 1 3.17.5.2 puts every type 
derived or constructed from ID, IDREF or IDREFS in the table, and Xerces does 
the same.
   
   The same code recorded an IDREF in a complex type with simple content under 
the complex type. That never compares equal to an ID, so 
`<t:id>a</t:id><t:refc>a</t:refc>` was rejected with "ID not found". Entries 
are now built from xs:ID or xs:IDREF, so that document validates.
   
   The lookup walks the list items and the union member that accepted the value 
with `SimpleValue.instanceType()` and `xgetListValue()`, and skips values that 
are not NCNames (lexically invalid, or belonging to another union member). 
Directly typed ID, IDREF and IDREFS values behave as before. No disagreement 
remains after the change, and `./gradlew test` is green. Regression test added.
   


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