xs:assert in Schema 1.1

This should cover W3C XML Schema, Relax NG and DTD related problems.
frauborinski
Posts: 8
Joined: Wed Jan 09, 2013 3:30 pm

xs:assert in Schema 1.1

Post by frauborinski » Thu Dec 05, 2013 10:42 am

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

Jamil
Posts: 77
Joined: Thu Oct 23, 2008 6:29 am

Re: xs:assert in Schema 1.1

Post by Jamil » 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.

adrian
Posts: 2515
Joined: Tue May 17, 2005 4:01 pm

Re: xs:assert in Schema 1.1

Post by adrian » Mon Dec 09, 2013 12:50 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Radu
Posts: 6211
Joined: Fri Jul 09, 2004 5:18 pm

Re: xs:assert in Schema 1.1

Post by Radu » Wed Jun 25, 2014 5:11 pm

Hi,

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

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply