- From: Bob Schloss <rschloss@us.ibm.com>
- Date: Wed, 29 May 2002 07:39:58 -0400
- To: AMADOU Vincent <vincent.amadou@post.be>, xmlschema-dev@w3.org
- Message-ID: <OFF143BAD2.A4282AD2-ON85256BC8.003EC31D@us.ibm.com>
You can use something like: <xs:element name="myElement"> <xs:complexType> <xs:sequence> <xs:element name="code" type="xs"integer"/> <xs:element name="description" minOccurs="2" maxOccurs="2"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="language"/> </xs:extension> </xs:simpleContent> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:attribute name="language"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="fr"/> <xs:enumeration value="en"/> </xs:restriction> </xs:simpleType> </xs:attribute> Because XML Schema 1.0 lacks general co-occurance constraints, you cannot specify that exactly one of the 2 description elements in the sequence must have attribute language="en" and exactly one of the 2 description elements in the sequence must have attribute language="fr". Bob AMADOU Vincent <vincent.amadou@post.be>@w3.org on 05/28/2002 09:16:05 AM Sent by: xmlschema-dev-request@w3.org To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org> cc: Subject: Element name duplication Hi, I would like to define a Xml Schema for this piece of XML: <myElement> <code>22</code> <description language="en">xxxxxxx</description> <description language="fr">xxxxxxx</description> <myElement> where both "description" tag are required. How can I specify this with Xml Schema ? Thanks Vincent
Received on Wednesday, 29 May 2002 07:42:05 UTC