[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: schema content model question


schema content model
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@l...]
Sent: Wednesday, March 06, 2002 8:18 AM
To: xml-dev@l...
Subject:  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>


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.