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

RE: HowTo describe some things using XML Schema

  • From: "Michael Kay" <mike@s...>
  • To: "'Slava'" <slava.mayorov@g...>,<xml-dev@l...>
  • Date: Mon, 10 Nov 2008 11:16:44 -0000

RE:  HowTo describe some things using XML Schema
Unfortunately, for reasons I do not understand, identity constraints (such
as key and unique) belong to an element declaration rather than to a type;
if you have several elements with this type, then each one will need to
declare the key separately. In XSD 1.1 you can declare the key once, and
then reference it from other elements.

As for question 3, XSD does not allow you to have two different content
models for the same element. This is fixed in XSD 1.1 using the mechanism of
"conditional type assignment" - you can say that the element must belong to
one type if it has an @id attribute, and to a different type if it does not.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Slava [mailto:slava.mayorov@g...] 
> Sent: 08 November 2008 09:10
> To: xml-dev@l...
> Subject:  HowTo describe some things using XML Schema
> 
> hi
> 
> im was develop an own format of XML document and want to 
> describe this format using XML Schema.
> 
> for example i have a ComplexType called "Cloud" with next schema:
> ==============================================================
> ========================
> <xsd:complexType name="Cloud">
> 	<xsd:sequence minOccurs="0" maxOccurs="1">
> 		<xsd:element name="parentclouds" minOccurs="0" 
> maxOccurs="1">
> 			<xsd:complexType>
> 				<xsd:choice minOccurs="0" 
> maxOccurs="unbounded">
> 					<xsd:element 
> name="cloud" type="CloudObject"/>
> 				</xsd:choice>
> 			</xsd:complexType>
> 		</xsd:element>
> 		<xsd:group ref="MandatoryAttributes" 
> minOccurs="0" maxOccurs="1"/>
> 		<xsd:group ref="Attributes" minOccurs="0" 
> maxOccurs="unbounded"/>
> 	</xsd:sequence>
> 	<xsd:attribute name="id" type="xsd:NMTOKEN" use="optional"/>
> 	<xsd:attribute name="name" type="xsd:string" use="required"/>
> 	<xsd:attribute name="type" type="xsd:string" 
> use="optional"/> </xsd:complexType> 
> ==============================================================
> ========================
> 
> 1. How to describe a Key which can be declared using @id 
> attribute in any elements of "Cloud" type.
> 2. How to describe a KeyRef which can refers to the @id 
> attribute (to the key from first question) 3. How to describe 
> an element which is either a "Cloud" or it can be simple 
> element with one attribute called @refid which is a KeyRef 
> from second question..
> 
> More simple.. how to describe this document:
> <cloud id="123" name="newcl"/>
> <cloud refid="123"/>
> <cloud id="1234" name="test"/>
> <cloud id="1234" name="test2"/> <-- an error key not unique 
> <cloud refid="xxx"/> <-- an error key not declared <cloud 
> refid="1234" name="test2"/> <-- an error (???), refid is used...
> 
> i.e.: when using @refid - the @name and @id attributes must 
> be prohibited and vice-versa
> 
> TIA
> 
> --
> ...with best regards && have a nice day...
> 
> ______________________________________________________________
> _________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by 
> OASIS to support XML implementation and development. To 
> minimize spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l... List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.