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

Re: alternative obligatory attributes

From: Kevin Braun <kbraun@obj-sys.com>
Date: Thu, 12 Mar 2009 13:39:49 -0400
Message-ID: <49B948E5.60009@obj-sys.com>
To: Erwin <Erwin.Kloeck@bayernlb.de>
CC: xmlschema-dev@w3.org
Re: alternative obligatory attributes
There is no straightforward way to do this that I know of.

Here is an outline of an approach.  I think it would work, but it won't 
help you if you have many such pairs of attributes on the same element.

Define a type for the element, TypeBase.  Make it abstract to force use 
of one of the derived types you are going to define.
Define an extension of TypeBase with the one attribute.
Define an extension of TypeBase with the other attribute.
Declare your element to be of TypeBase.
Use xsi:type in the instance to specify which of the derived types is 
being used.  OR, use a substitution group (but that will mean using 
global elements).

HTH,
Kevin

On 3/12/2009 1:06 PM, Klöck wrote:
>
> Hi,
>
> is it possible to define alternative obligatory attributes for an 
> element? What I want is something like the following,
> where the element otto must have either of two attributes but not 
> both. If it is possible, how would one do this?
>
> <top>
>         <file uri="xxxx"/>
>         <file relative-path="yyyy"/>
> </top>
>
> Thank you for your interest.
>
>
> *Erwin Klöck*
>    Bayerische Landesbank
>    Geschäftsbereich Financial Office, IT and Operations
>    Organisation & Informatik
>    Team Banksteuerung Finance -4493-
>    Brienner Straße 24R/
> /   D-80333 München
>    Telefon: +49 89 / 2171-21420
>    Telefax: +49 89 / 2171-27546
>    _mailto:erwin.kloeck@bayernlb.de_
>    Internet: _http://www.bayernlb.de_
>
>    HRA München 76030; Sitz: München
>
>
>
Received on Thursday, 12 March 2009 17:41:45 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.