rcase-Recurse with xs:redefine nested groups

C

Cat

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm getting a validation error when I try to restrict the content of nested
groups with xs:redefine whereas the same restriction on xs:element's validates.

============== BASE XMLSCHEMA =================
<?xml version="1.0"?>
<xs:schema targetNamespace="test" xmlns="test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root" type="xs:token"/>

<xs:group name="groups">
<xs:sequence>
<xs:group ref="group1" minOccurs="0" maxOccurs="1"/>
<xs:group ref="group2" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:group>

<xs:group name="elements">
<xs:sequence>
<xs:element name="three" minOccurs="0" maxOccurs="1"/>
<xs:element name="four" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:group>

<xs:group name="group1">
<xs:sequence>
<xs:element name="one" type="xs:token"/>
</xs:sequence>
</xs:group>

<xs:group name="group2">
<xs:sequence>
<xs:element name="two" type="xs:token"/>
</xs:sequence>
</xs:group>
</xs:schema>
============= REDEFINED XMLSCHEMA ============
<?xml version="1.0"?>
<xs:schema targetNamespace="test" xmlns="test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:redefine schemaLocation="test.xsd">
<xs:group name="groups">
<xs:sequence>
<xs:group ref="group1" minOccurs="0" maxOccurs="0"/>
<xs:group ref="group2" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:group>

<xs:group name="elements">
<xs:sequence>
<xs:element name="three" minOccurs="0" maxOccurs="0"/>
<xs:element name="four" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:group>
</xs:redefine>
</xs:schema>
============ XML FILE ===================
<?xml version="1.0"?>
<root xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns="test" xsi:schemaLocation="test xsd/test2.xsd"/>
=========================================
I get the following error message.

rcase-Recurse.1: Group's occurrence range, (0,unbounded), is not a valid
<wrapped>-->restriction of base group's occurrence range, (1,1).
Column: 27 Line: 5
src-redefine.6.2.2: Group 'groups' does not properly restrict the group it
<wrapped>-->redefines; constraint violated: 'rcase-Recurse.1'.
Column: 27 Line: 5

and curiously if I change the maxOccurs for the *other* element to a random
value such as 42 I get the following error message.
================= NEW BASE XMLSCHEMA ==========
<?xml version="1.0"?>
<xs:schema targetNamespace="test" xmlns="test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root" type="xs:token"/>

<xs:group name="groups">
<xs:sequence>
<xs:group ref="group1" minOccurs="0" maxOccurs="1"/>
<xs:group ref="group2" minOccurs="0" maxOccurs="42" /> <!--NOTE-->
</xs:sequence>
</xs:group>

<xs:group name="elements">
<xs:sequence>
<xs:element name="three" minOccurs="0" maxOccurs="1"/>
<xs:element name="four" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:group>

<xs:group name="group1">
<xs:sequence>
<xs:element name="one" type="xs:token"/>
</xs:sequence>
</xs:group>

<xs:group name="group2">
<xs:sequence>
<xs:element name="two" type="xs:token"/>
</xs:sequence>
</xs:group>
</xs:schema>
================== NEW REDEFINED XMLSCHEMA =========
<?xml version="1.0"?>
<xs:schema targetNamespace="test" xmlns="test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:redefine schemaLocation="test.xsd">
<xs:group name="groups">
<xs:sequence>
<xs:group ref="group1" minOccurs="0" maxOccurs="0"/>
<xs:group ref="group2" minOccurs="0" maxOccurs="42"/> <!--NOTE-->
</xs:sequence>
</xs:group>

<xs:group name="elements">
<xs:sequence>
<xs:element name="three" minOccurs="0" maxOccurs="0"/>
<xs:element name="four" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:group>
</xs:redefine>
</xs:schema>
=======================================================
with the xml file unchanged I get the following error message. Note the 42!

<!--NOTE-->
rcase-Recurse.1: Group's occurrence range, (0,42), is not a valid restriction
<wrapped>-->of base group's occurrence range, (1,1).
Column: 27 Line: 5
src-redefine.6.2.2: Group 'groups' does not properly restrict the group it
<wrapped>-->redefines; constraint violated: 'rcase-Recurse.1'.
Column: 27 Line: 5

I am using the xerces 2.6.2 from J2SE 5.0
- --
Cat

http://www.ratrobot.com/programming/shell/ Some simple shell
scripts and my bash prompt. Free for any use by anyone.
Thu Jan 27 02:07:40 UTC 2005
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFB+EzsKHRjYtwQ1QARAszGAKD8+nXT4hOND8iHbU9NCLNOcDmUnQCdHVOT
UPs2zeMZ5N2EIZoaAVJFFnk=
=xiKr
-----END PGP SIGNATURE-----
 
C

Cat

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 27 Jan 2005 13:08:08 +1100, Cat wrote:
<snip/>
As I seem to understand it the problem is the same as I ran into previously
with the removal of 'pointless' xs:sequences. When I remove the second
element, through the xs:group reference, the xs:sequence holds only one
child and so becomes 'pointless' and is correctly removed at which point the
occurance range of the parent group is that of it's child element which is
(0,42) when in the original it was (1,1), the default.

I haven't worked out a solution yet but adding a dummy element to the
group stopping it from being removed does as expected make it validate.
============ BASE ===============
<?xml version="1.0"?>
<xs:schema targetNamespace="test" xmlns="test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root" type="xs:token"/>

<xs:group name="groups">
<xs:sequence>
<xs:group ref="group1" minOccurs="0" maxOccurs="1"/>
<xs:group ref="group2" minOccurs="0" maxOccurs="42" />
<xs:element name="dummy" type="xs:token"/>
</xs:sequence>
</xs:group>

<xs:group name="group1">
<xs:sequence>
<xs:element name="one" type="xs:token"/>
</xs:sequence>
</xs:group>

<xs:group name="group2">
<xs:sequence>
<xs:element name="two" type="xs:token"/>
</xs:sequence>
</xs:group>
</xs:schema>
=========== REDEFINED =============
<?xml version="1.0"?>
<xs:schema targetNamespace="test" xmlns="test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:redefine schemaLocation="test.xsd">
<xs:group name="groups">
<xs:sequence>
<xs:group ref="group1" minOccurs="0" maxOccurs="0"/>
<xs:group ref="group2" minOccurs="0" maxOccurs="42"/>
<xs:element name="dummy" type="xs:token"/>
</xs:sequence>
</xs:group>
</xs:redefine>
</xs:schema>
- --
Cat

http://www.ratrobot.com/java/beginner/ An absolute beginners step by
step guide on how to use java applets.
Thu Jan 27 04:42:45 UTC 2005
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFB+HFFKHRjYtwQ1QARAq1sAJ98bLRwDq8mgJ15pSLHIcxPBV/wpACeLSdV
RZQWrPa1pB1dYmfe0kYJYHQ=
=9PbM
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top