XML Schema 1.1: improvements to assertion facet evaluation on schema simpleType 
on attributes
---------------------------------------------------------------------------------------------

                 Key: XERCESJ-1489
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1489
             Project: Xerces2-J
          Issue Type: Improvement
          Components: XML Schema 1.1 Datatypes
    Affects Versions: 2.11.0
            Reporter: Mukul Gandhi
            Assignee: Mukul Gandhi
            Priority: Minor


I made a SVN commit r1044567 yesterday with a fix related to assertion facet 
evaluation as mentioned in the subject of this bug report. This particular 
commit solved this issue, and I thought it's probably good to create a JIRA 
issue to explain what the issue exactly was and how this commit solved this 
issue. Any comments about this fix from fellow committers and Xerces 
dev-community would be welcome.

Please consider these sample XML and schema documents.

XML 1:
<A x="100" />

XML 2:
<A x="101" />

XML Schema 1.1 document:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>

        <xs:element name="A">
             <xs:complexType>
                  <xs:attribute name="x" type="MYINT" />
             </xs:complexType>
        </xs:element>
        
        <xs:simpleType name="MYINT">
             <xs:restriction base="xs:int">
                  <xs:assertion test="$value mod 2 = 0" />
             </xs:restriction>
        </xs:simpleType>
  
</xs:schema>

(the XML schema simpleType in the above schema specifies, that an atomic value 
in instance document must be an even integer)

The above schema document must report XML document 1 as valid while XML 
document 2 as invalid. In the specified schema the simpleType "MYINT" would 
validate the relevant XML attribute's value and the assertion XPath context 
variable $value would be assigned the attribute's value (with necessary schema 
type annotation).

The code-base in Xerces 2.11.0 release didn't set the correct simpleType 
variety on the Xerces schema assertion object XSAssertImpl (when that relates 
to XML attributes), in case the variety was 'atomic' (but the implementation 
was correct for simpleType varieties 'list' and 'union'). This defect caused 
such assertions (as specified in an example above) to be skipped from 
evaluation.

The commit I've mentioned has solved this particular issue.

Thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to