W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2002

need help with a schema -- 'all' group

From: by way of <xvwang@yahoo.com>
Date: Tue, 24 Sep 2002 15:48:17 -0600
Message-Id: <5.1.0.14.1.20020924154814.0268b880@localhost>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>




I need a schema for the following XML:
(In "Test", all of the elements (name, description,
case) are not in any particular order. "name" and
"description" appear 0 or 1 time. "case"
appears 0 to unbounded times.)

<Test>
   <name>my test</name>
   <description>need help</description>
   <case ref="case1"/>
   <case ref="case2"/>
</Test>

<Case id="case1"/>
<Case id="case2"/>

Is this possible at all?

The closest thing that I do know how to model is the
following:

<Test>
   <name>my test</name>
   <description>need help</description>
   <set_of_cases>
     <case ref="case1"/>
     <case ref="case2"/>
   </set_of_cases>
</Test>
<Case id="case1"/>
<Case id="case2"/>

schema:

<xs:complexType name="Test">
   <xs:all>
     <xs:element name="name"/>
     <xs:element name="description"/>
     <xs:element ref="set_of_cases"/>
   </xs:all>
</xs:complexType>

<xs:element name="set_of_cases">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="case" minOccurs="1"
maxOccurs="unbounded">
          <xs:complexType>
             <xs:attribute name="ref"/>
           </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
</xs:element>

Thank you very much.

victoria

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com 
Received on Tuesday, 24 September 2002 18:56:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:01 GMT