Support of assertions in Xerces 2.11.0 (beta)

Vinícius Lopes <[email protected]>
Newsgroups gmane.text.xml.xerces-j.user
Message-ID <CAD+7EUt_2x5=RDcyJ8OyrFoianhrH=VVvvTShLQFs+aFuYFHJg@mail.gmail.com>
I've been testing Xerces with some schemas 1.1, more specifically, those
with assertions. Xerces do not complain when I use a valid XML with a given
Schema. However, if I use an invalid XML, it doesn't complain either. I
used many samples, but I will show a simple case.

Below is a simple Schema 1.1.

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified">

    <element name="Example">
        <complexType>
            <sequence>
                <element name="even-integer">
                    <simpleType>
                        <restriction base="integer">
                            <assertion test="$value mod 2 = 0" />
                        </restriction>
                    </simpleType>
                </element>
            </sequence>
        </complexType>
    </element>

</schema>

I tested the following XML using the schema above:

<?xml version="1.0" encoding="utf-8"?>
<Example xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="even-integers_v1.xsd">

    <even-integer>21</even-integer>

</Example>

To test this, I'm instantiating an SchemaFactory using the following line:
schemaFactory = SchemaFactory.newInstance("
http://www.w3.org/XML/XMLSchema/v1.1");

So, I'm using the Schema 1.1 in my code, and the parser doesn't generate
any error when it parses the XML above, using the above schema. In Xerces
main page, it says assertions are supported, so I believe I may be doing
something wrong, but I haven't been able to find the mistake. Do you have
any suggestions ?

Thanks,
            Vinícius
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.