[ 
https://issues.apache.org/jira/browse/XERCESJ-1559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13294827#comment-13294827
 ] 

Mukul Gandhi commented on XERCESJ-1559:
---------------------------------------

Hi Jorge,
   Thanks for these references in the spec.

Here's what I've found now working fine with Xerces XSD 1.1 implementation.

1) 

The XML instance document,
<X>
  <a/>
</X>

get successfully validated by the following XSD schema,

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

      <xs:element name="X">
           <xs:complexType>
              <xs:sequence>
                   <xs:element name="a"/>
              </xs:sequence>
           </xs:complexType>
      </xs:element>
        
</xs:schema>


2)  

The XML instance document,

<X xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:type="T1">
  <a/>
</X>

get successfully validated by the following XSD schema,

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
        
        <xs:complexType name="T1">
             <xs:sequence>
                 <xs:element name="a"/>
             </xs:sequence>
             <xs:assert test="not(a/*)">
                 <xs:annotation>
                     <xs:documentation>no child elements within 'a' are 
allowed</xs:documentation>
                 </xs:annotation>
           </xs:assert>
        </xs:complexType>
        
</xs:schema>

and I do find assertion in this case to be successfully executed.

Do you think, there's any bug with our implementation wrt the areas of XSD 1.1 
specification you've cited? I can't seem to conclude, that there's a bug for 
these scenarios.



Thanks,
Mukul
                
> absence of XML root element declaration is ignored, to determine XSD validity 
> when xsi:type is used on an root XML element instance
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1559
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1559
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Datatypes, XML Schema 1.1 Datatypes
>    Affects Versions: 2.11.0
>            Reporter: Jorge L. Williams
>            Assignee: Mukul Gandhi
>
> In the latest XSD 1.1 branch,  it looks like simple type assertions are not 
> being enforced when the type is specified via the xsi:type attribute.  I'm 
> attaching a schema and instance documents as a reference.
> If I do
> java -cp $CLASSPATH jaxp.SourceValidator  -fx -xsd11 -a  assertion.xsd -i 
> even_bad.xml 
> I get a correct error, but if I do
> java -cp $CLASSPATH jaxp.SourceValidator  -fx -xsd11 -a  assertion.xsd -i 
> number_bad.xml 
> I don't get an error at all.
> assertion.xsd:
> ---------------------
> <schema
>     elementFormDefault="qualified"
>     attributeFormDefault="unqualified"
>     xmlns="http://www.w3.org/2001/XMLSchema";
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>     xmlns:tst="http://www.rackspace.com/test/assertion";
>     targetNamespace="http://www.rackspace.com/test/assertion";>
>     <element name="even" type="tst:Even"/>
>     <!-- Simple Types -->
>     <simpleType name="Even">
>         <restriction base="xsd:int">
>             <minInclusive value="0"/>
>             <maxInclusive value="100"/>
>             <assertion test="$value mod 2 = 0"/>
>         </restriction>
>     </simpleType>
> </schema>
> -------------
> even_bad.xml
> -----------
> <even xmlns="http://www.rackspace.com/test/assertion";>13</even>
> -----------
> number_bad.xml
> ------------
> <number xmlns:tst="http://www.rackspace.com/test/assertion";
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>         xsi:type="tst:Even"
>         >13</number>
> ------------

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to