Page 1 of 1

How to use <all> in a <group>?

Posted: Fri Aug 19, 2005 5:52 pm
by mrespass
Hi,

I'm using Oxygen 5.1. I want to create a group in my schema and I hate using <sequence> so I want to use <all>. Here is what I thought I wanted but I'm doing something wrong. It seems that somewhere I must specify minOccurs = maxOccurs = 1 but I can't find the right place for that. Below is the part of the schema and below that is the error I get. Can anyone help?

Thanks a lot
Marc

<xs:group name="yearly_amounts_totals_group">
<xs:all >
<!-- #5 -->
<xs:element name="obligations_total" type="xs:decimal"/>
<!-- #6 (#5 minus #3) -->
<xs:element name="adjusted_ygi" type="xs:decimal"/>
<!-- #7 (percentage from dividing income by combined income) -->
<xs:element name="share_gross_income" type="xs:decimal"/>
</xs:all>
</xs:group>

Error:
SystemID: /Users/mrespass/Developer/_MJS/DHHS/dhhs.xsd
Location: 110:54
Description: E cos-all-limited.1.2: An 'all' model group must appear in a particle with {min occurs} = {max occurs} = 1, and that particle must be part of a pair which constitutes the {content type} of a complex type definition.
URL: http://www.w3.org/TR/xmlschema-1/#cos-all-limited

Posted: Wed Aug 31, 2005 11:26 am
by george
Hi,

The problem is not in the code you posted but in the part that makes a reference to the group.

Best Regards,
George

Posted: Sat Dec 03, 2005 5:33 am
by jsb
george wrote:Hi,

The problem is not in the code you posted but in the part that makes a reference to the group.

Best Regards,
George
So ... what's the right answer?

Jon

Posted: Mon Dec 05, 2005 6:33 pm
by sorin_ristache
Hello,

To find the declaration causing the error all the references to the yearly_amounts_totals_group group should be available. For example the following reference to the group violates the part of the XML Schema spec pointed by the clickable URL (the book icon) available in the Info column of the Errors view table (only in the <oXygen/> standalone distribution):

Code: Select all

<xs:element name="e">
<xs:complexType>
<xs:sequence>
<xs:group ref="yearly_amounts_totals_group"/>
</xs:sequence>
</xs:complexType>
</xs:element>
In this example removing the xs:sequence tag and placing the xs:group reference directly in the xs:complexType makes the element definition valid.

Regards,
Sorin