You shouldn't need to define X at all, right?  ...or am I missing something?  
If you remove

> <xs:element name="X" type="xs:integer"/>

from your schema, you'll see the same issue I am....the XML appears valid but 
it's not.

The saxon implementation always reports an error, whether or not the <element 
is defined -- and I believe that's the correct behavior.  I'll go ahead and 
fill in a JIRA.

-jOrGe W.


On Apr 3, 2012, at 4:36 PM, Mukul Gandhi wrote:

> Hi Jorge,
>   Here's a different example I tried.
> 
> XSD 1.1 schema:
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
> 
>    <xs:element name="X" type="xs:integer"/>
>       
>    <xs:simpleType name="EvenInteger">
>         <xs:restriction base="xs:integer">
>              <xs:assertion test="$value mod 2 = 0"/>
>         </xs:restriction>
>    </xs:simpleType>
>       
> </xs:schema>
> 
> And the following XML documents were validated by the above schema,
> 
> <X>3</X>  (this is reported as valid, since it uses the type
> xs:integer for validation)
> 
> and
> 
> <X xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:type="EvenInteger">5</X>    (this is reported as invalid, since it
> uses the type "EvenInteger" via xsi:type)
> 
> I therefore do not think, that xs:assertion within xs:simpleType works
> incorrectly, when such a type is selected via xsi:type from an XML
> instance document.
> 
> I'm currently not sure, whether the observation you've shared may be a
> potential bug with Xerces. You may report it at Xerces Jira and
> someone would analyze it and respond appropriately.
> 
> On Mon, Apr 2, 2012 at 10:49 PM, Jorge Williams
> <jorge.willi...@rackspace.com> wrote:
>> hmm..attachments didn't seem to go through?
>> 
>> 
>> On Apr 2, 2012, at 4:38 PM, Jorge Williams wrote:
>> 
>> 
>> Hello again,  found another potential bug:
>> 
>> 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.
>> 
>> Thanks,
>> 
>> jOrGe W.
> 
> 
> 
> -- 
> Regards,
> Mukul Gandhi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-users-h...@xerces.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to