RE: constraining an element to be either simple or complex content

This is similar to another question I replied to a short while ago.

 

Create an element that has a choice at the top level.  Let the 2
sublements in the choice have simple 

content and complex content respectively.  This creates one more level
in the hierarchy than you want

but it will do the trick.

All the best, Ashok 
=========================================================== 
Ashok Malhotra              <mailto: ashokma@microsoft.com
<mailto:%20ashokma@microsoft.com> > 
Microsoft Corporation 
212 Hessian Hills Road 
Croton-On-Hudson, NY 10520 USA 
Redmond: 425-703-9462                New York: 914-271-6477 

 

-----Original Message-----
From: Dolan, Kieran [mailto:DolanK@logica.com] 
Sent: Friday, October 19, 2001 6:56 AM
To: xmlschema-dev@w3.org
Subject: constraining an element to be either simple or complex content

 

Hi

 

Is there any way in XML schema to specify that an element contains
either simple content or complex content but not both?. For example:

<X>23</X> is valid and <X><Y>45</Y></X> is also valid but  not
<X>23<Y>45</Y></X>. Use of a "mixed" content model permits the first two
cases but does not exclude the last one. 

 

I have tried to extend a complex type containing complex content from a
complex type containing simple content. XML Spy version 4.0 allows this
but I understand from previous postings in this group that this is not a
correct XML schema construct. 

Is there any other schema specification mechanism that supports this ?

 

thanks for any help you can give on this

 

Kieran Dolan

 

Logica Mobile Networks

250 Brook Drive

Reading

United Kingdom


This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by, any other party. If you are
not an intended recipient then please promptly delete this e-mail and
any attachment and all copies and inform the sender. Thank you.

Received on Friday, 19 October 2001 17:01:58 UTC