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

   Same schema and document, three validators:
   
       <t:root xmlns:t='urn:t' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' a='1' xsi:foo='x'/>
   
       XmlObject.validate()        -> true, no errors
       ValidatingXMLStreamReader   -> cvc-complex-type.3.2.1: Attribute not 
allowed (no wildcards allowed): foo@http://www.w3.org/2001/XMLSchema-instance 
in element root@urn:t
       JDK Xerces                  -> cvc-complex-type.3.2.2: Attribute 
'xsi:foo' is not allowed to appear in element 't:root'.
   
   Found with a differential run of XmlObject.validate(), 
ValidatingXMLStreamReader and the JDK validator over the same schemas and 
documents. This was the only attribute case where they disagreed.
   
   Cause: `impl.store.Validate.doAttrs` drops every attribute in the xsi 
namespace before the Validator sees it. Only xsi:type, xsi:nil, 
xsi:schemaLocation and xsi:noNamespaceSchemaLocation are exempt from attribute 
assessment (cvc-complex-type.3.2). Any other xsi attribute has to be declared 
or matched by a wildcard. So an element type with no attribute wildcard accepts 
arbitrary `xsi:*` attributes through XmlObject.validate().
   
   Fix: skip only those four names, the same set 
`ValidatingXMLStreamReader.isSpecialAttribute` already uses. An xsi attribute 
that matches an `xs:anyAttribute` still validates. `XsiAttributeValidateTest` 
fails on the current tree and passes with the change. The full test suite 
passes (3245 tests, 0 failures).
   


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