[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: schema content model question
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|