Page 1 of 1

xs:assert in Schema 1.1

Posted: Thu Dec 05, 2013 10:42 am
by frauborinski
Hello,
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:sequence>
<xs:choice minOccurs="0" maxOccurs="2">
<xs:element ref="le:Einführung"/>
<xs:element ref="le:Lernziele"/>
</xs:choice>
<xs:element minOccurs="1" maxOccurs="unbounded" ref="le:Textebene-1"/>
</xs:sequence>
<xs:assert test="count(le:Einführung) le 1"/>
</xs:complexType>
If I test »Lernziele« this way, everything is OK. If I test »Einführung« there is an error:
E [Xerces] cvc-xpath.3.13.4.2a: 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

Re: xs:assert in Schema 1.1

Posted: Sun Dec 08, 2013 12:49 am
by Jamil
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.

Re: xs:assert in Schema 1.1

Posted: Mon Dec 09, 2013 12:50 pm
by adrian
Hello,

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.

Regards,
Adrian

Re: xs:assert in Schema 1.1

Posted: Wed Jun 25, 2014 5:11 pm
by Radu
Hi,

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

Regards,
Radu