xs:assert in Schema 1.1

This should cover W3C XML Schema, Relax NG and DTD related problems.
Posts: 8

xs:assert in Schema 1.1

Thu Dec 05, 2013 10:42 am

usually I work with two Elements: »Lernziele« and »Einführung«. I would like to use the xs:assert to give an error indication, if someone choose one of them twice. You see it below.

Code: Select all

    <xs:complexType name="defKapitel">
            <xs:choice minOccurs="0" maxOccurs="2">
                <xs:element ref="le:Einführung"/>
                <xs:element ref="le:Lernziele"/>
            <xs:element minOccurs="1" maxOccurs="unbounded" ref="le:Textebene-1"/>
        <xs:assert test="count(le:Einführung) le 1"/>     

If I test »Lernziele« this way, everything is OK. If I test »Einführung« there is an error:
E [Xerces] cvc-xpath. XPST0003 - Assertion XPath expression ('count(le:Einführung) le 1') on the schema type 'defKapitel' couldn't compile successfully.

If I change »Einführung« to »Einfuhrung«, everything is OK - but then I have a new problem - a semantic one ...

Best regards
Ulrike Borinski
Posts: 77

Re: xs:assert in Schema 1.1

Sun Dec 08, 2013 12:49 am

Since no one responded, I took a quick look at this. I had to add more to your schema, since it was not posted in its entirety. I reproduced this issue.

It looks like the issue is due to the ü character in Einführung. Something is not able to handle this Unicode character would be my guess. If I change just that one character to something else (in my case, I changed it to u), it works without that error appearing.
Posts: 2426

Re: xs:assert in Schema 1.1

Mon Dec 09, 2013 12:50 pm


I've tested with your example in v15.1 of Oxygen and it looks like Xerces has trouble with special characters in XPath expressions from asserts. We'll forward this problem to the Xerces developers.
I can't find a workaround for Xerces. I've tried using character entity references, but it doesn't make any difference.

Note however that Saxon-EE validates this correctly, so one workaround in Oxygen is to set Saxon-EE as the default schema validation engine in: Options > Preferences, XML > XML Parser > XML Schema.

Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
Posts: 5459

Re: xs:assert in Schema 1.1

Wed Jun 25, 2014 5:11 pm


This issue should be fixed in the Xerces parser which comes with Oxygen 16.0.

Radu Coravu
<oXygen/> XML Editor

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 0 guests