Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > rcase-Recurse with xs:redefine nested groups

Reply
Thread Tools

rcase-Recurse with xs:redefine nested groups

 
 
Cat
Guest
Posts: n/a
 
      01-27-2005
-----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"
xmlnss="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"
xmlnss="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 xmlnssi='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"
xmlnss="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"
xmlnss="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+nXT4hOND8iHbU9NCL NOcDmUnQCdHVOT
UPs2zeMZ5N2EIZoaAVJFFnk=
=xiKr
-----END PGP SIGNATURE-----

 
Reply With Quote
 
 
 
 
Cat
Guest
Posts: n/a
 
      01-27-2005
-----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"
xmlnss="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"
xmlnss="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+HFFKHRjYtwQ1QARAq1sAJ98bLRwDq8mgJ15pSLHIc xPBV/wpACeLSdV
RZQWrPa1pB1dYmfe0kYJYHQ=
=9PbM
-----END PGP SIGNATURE-----

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Groups of groups with PIX. AM Cisco 2 01-31-2006 04:37 PM
match groups: optional groups not accessible david.reitter@gmail.com Python 3 06-10-2005 05:03 PM
getting values from URL such as http://groups.google.co.uk/groups?q=parameters+url+asp.net&start=10&hl=en&lr=& anonymous ASP .Net 1 05-08-2005 03:58 PM
Windows groups, VPN groups, and SecureACS John Sasso Cisco 0 10-02-2004 03:39 PM
Reading membership of groups (including nested groups) Petra Hübner ASP .Net 0 02-16-2004 07:07 PM



Advertisments