W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2002

Help: Is this possible at all with XML schema?

From: xin wang <xvwang@yahoo.com>
Date: Wed, 25 Sep 2002 09:45:16 -0700 (PDT)
Message-ID: <20020925164516.20272.qmail@web11002.mail.yahoo.com>
To: xmlschema-dev@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 Wednesday, 25 September 2002 12:45:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT