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

Re: elements type attribute question

From: Sandy Gao <sandygao@ca.ibm.com>
Date: Fri, 3 Feb 2006 09:45:46 -0500
To: "Natarajan Ravi" <Ravi.Natarajan@cfh.nhs.uk>
Cc: xmlschema-dev@w3.org
Message-ID: <OF344CA1F4.53FB93B2-ON8525710A.0050E37B-8525710A.00511C3C@ca.ibm.com>
elements.type
Short answer: not allowed.

Medium answer: why? How do you determine which type to use?

Long answer: declare a base type, and derive all your choice types from 
that base. Use the base type in the element declaration. Use xsi:type in 
your instance to indicate which type to use for validation.

Thanks,
Sandy Gao
XML Parser Development, IBM Canada
(1-905) 413-3255
sandygao@ca.ibm.com


xmlschema-dev-request@w3.org wrote on 02/03/2006 03:53:17 AM:

> 
>     I would like have an element declaration whose "type" is a 
> choice (1..n) other complex types. <xs:element name="test" 
> type="ComplexType_1 | Complex_Type_2" />.  Effectively I would like 
> to dynamically decide type at declaration stage which is a choice.
> Regards
> 
> Ravi
> This e-mail is confidential and privileged. If you are not the 
> intended recipient please accept our apologies; please do not 
> disclose, copy or distribute information in this e-mail or take any 
> action in reliance on its contents: to do so is strictly prohibited 
> and may be unlawful. Please inform us that this message has gone 
> astray before deleting it. Thank you for your co-operation.
Received on Friday, 3 February 2006 15:17:02 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
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-2007 All Rights Reserved.