Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xml-dev] Schema definition of element with optional children

From: "Joe Fawcett" <joefawcett@-------.--->
To: xml-dev@-----.---.---
Date: 5/2/2006 2:03:00 PM
Thanks Mike

So I can have a choice of two complexTypes, adressFullType and 
addressDeletedType?

Joe


>From: "Michael Kay" <mike@s...>
>To: <joe@r...>,<xml-dev@l...>
>Subject: RE: [xml-dev] Schema definition of element with optional children
>Date: Tue, 2 May 2006 14:55:24 +0100
>
>You can't declare the type of the element to be conditional on one of its
>attributes, unless the attribute has the magic name xsi:type. Your only
>options are (a) to define a type that's sufficiently permissive to allow 
>all
>the options, and then do extra validation using some other technology, or
>(b) to use different element names for the two cases. Alternatively, in 
>this
>case you could use the magic xsi:nil attribute to mean status="deleted".
>
>Michael Kay
>http://www.saxonica.com/
>
> > -----Original Message-----
> > From: Joe Fawcett [mailto:joefawcett@h...]
> > Sent: 02 May 2006 14:48
> > To: xml-dev@l...
> > Subject: [xml-dev] Schema definition of element with optional children
> >
> > Dear All
> >
> > I'm struggling to find the best way to restrict an element
> > that holds address data.
> > If the address is to be deleted it will look like this:
> > <address recordStatus="deleted"/>
> >
> > if it's new or an update it will be along the lines of:
> >
> > <address recordStatus="inserted">
> >   <addressLine1></addressLine1>
> >   <addressLine2></addressLine2>
> >   <city></city>
> >   <postCode></postCode>
> >   <country></country>
> > </address>
> >
> > with various fields being optional, these are UK addresses only.
> >
> > What's the most efficient way to declare this using XSD only
> > as I believe I can't say, "if recordStatus = 'deleted' then..." etc?
> >
> > I believe I have to give a choice of two types but this seems tedious?
> >
> > Thanks
> >
> > Joe
> >
> >
> >
> > -----------------------------------------------------------------
> > 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://www.oasis-open.org/mlmanage/index.php>
> >
>
>
>-----------------------------------------------------------------
>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://www.oasis-open.org/mlmanage/index.php>
>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent