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

This should cover W3C XML Schema, Relax NG and DTD related problems.
mrespass
Posts: 1
Joined: Fri Aug 19, 2005 5:49 pm

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

Post 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
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post 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
jsb
Posts: 20
Joined: Sat Nov 26, 2005 5:17 pm
Location: Houston, Texas, USA
Contact:

Post 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
Jon Berndt
Development Coordinator
JSBSim Project
Open Source Flight Dynamics Model
http://www.jsbsim.org
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
Post Reply