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] schema content model question

[ Lists Home | Date Index | Thread Index ]

Morgan:

Based on your requirements, seems like you want something like this -

<Dress size="small|medium|large">Good|Bad|Ugly</Dress>

- the element can have only restricted character data and also, attributes
with only restricted enumeration values.

One way to achieve this is through the schema below -

	<xs:element name="Dress" type="MyDressType" />

	<xs:complexType name="MyDressType">
		<xs:simpleContent>
			<xs:restriction base="DressType">
				<xs:enumeration value="Good" />
				<xs:enumeration value="Bad" />
				<xs:enumeration value="Ugly" />
			</xs:restriction>
		</xs:simpleContent>
	</xs:complexType>

	<xs:complexType name="DressType">
	 	<xs:simpleContent>
	 		<xs:extension base="xs:token">
	 			<xs:attribute name="size" type="SizeType" />
	 		</xs:extension>
	 	</xs:simpleContent>
	</xs:complexType>

	<xs:simpleType name="SizeType">
		<xs:restriction base="xs:token">
			<xs:enumeration value="small" />
			<xs:enumeration value="medium" />
			<xs:enumeration value="large" />
		</xs:restriction>
	</xs:simpleType>


Curious to find out, whether this meets your needs.

--Naren


-----Original Message-----
From: Morgan V. Cundiff [mailto:mcundiff@loc.gov]
Sent: Wednesday, March 06, 2002 8:18 AM
To: xml-dev@lists.xml.org
Subject: [xml-dev] schema content model question



I have been attempting to create an XML Schema content model for an
element like the following:

- the element should contain text only, no subeleemnts (simpleContent?)
- the permissable values of the element should be restricted to a list of
enumerated string values
- the element should also have attributes with values which are also
restricted to list of enumerated string values.

Is this possible? I have made several attempts which I will send if it is
useful for discussion but I thought perhaps someone can just provide the
answer.

thanks,
Morgan Cundiff
Library of Congress


-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>





 

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

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