OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Either ... or ... in Schema

[ Lists Home | Date Index | Thread Index ]

DTD:

<!ELEMENT ElementName (enum1 | enum2 | enum3 | enum4)>

XML Schema:

<xs:element name="ElementName" type="Enum"/>

<xs:complexType name="Enum">
 <xs:choice>
  <xs:element name="enum1" type="xs:string"/>
  <xs:element name="enum2" type="xs:string"/>
  <xs:element name="enum3" type="xs:string"/>
  <xs:element name="enum4" type="xs:string"/>
 </xs:choice>
</xs:complexType>

Or:

<xs:element name="ElementName">
 <xs:complexType>
  <xs:choice>
   <xs:element name="enum1" type="xs:string"/>
   <xs:element name="enum2" type="xs:string"/>
   <xs:element name="enum3" type="xs:string"/>
   <xs:element name="enum4" type="xs:string"/>
  </xs:choice>
 </xs:complexType>
</xs:element>

Or do you want string content of ElementName to be an enumeration?

<xs:simpleType name="Enum">
 <xs:restriction base="xs:string">
  <xs:enumeration value="enum1-string"/>
  <xs:enumeration value="enum2-string"/>
  <xs:enumeration value="enum3-string"/>
  <xs:enumeration value="enum4-string"/>
 </xs:restriction>
</xs:simpleType>

RELAX NG:

<element name="ElementName">
 <choice>
  <element name="enum1"><text/></element>
  <element name="enum2"><text/></element>
  <element name="enum3"><text/></element>
  <element name="enum4"><text/></element>
 </choice>
</element>

Or:

<element name="ElementName">
 <choice>
  <value>enum1-string</value>
  <value>enum2-string</value>
  <value>enum3-string</value>
  <value>enum4-string</value>
 </choice>
</element>

Mike

-----Original Message-----
From: rajac [mailto:rajac@ncmr.co.in]
Sent: Wednesday, February 27, 2002 9:37 AM
To: xml-dev@lists.xml.org
Subject: [xml-dev] Either ... or ... in Schema


Hi,
  In DTD, i have something like this,
   <Element ElementName   (enum1|enum2|enum3|......)>
   This indicates that ElementName must have atleat one of these
nodes(enum1,enum2,enum3,......).

  How this can be done in XML Schema?.

Regards,
Raja





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS