Re: Choice between complextContent and complexType

Karl Stubsjoen <[email protected]>
Newsgroups gmane.text.xml.schema.devel
Message-ID <[email protected]>
Hi Mukul,
I'm trying to stick with 1.0 standards.  If there is not a 1.0
solution than I think I must define a new child element of
description.  This is what I am doing now.
Thanks,
Karl..

On Wed, Jun 15, 2011 at 8:40 PM, Mukul Gandhi <[email protected]> wrote:
> Hi Karl,
>     One way is to use the type alternative construct from XML Schema
> 1.1. Here's probably something we may be able to do for this use case
> (this is untested),
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
>     <xs:element name="description" type="xs:anyType">
>           <xs:alternative test="@isExt = true()" type="EXT_formInputTypes"/>
>           <xs:alternative type="SEQ_TYPE"/>
>     </xs:element>
>
>    <xs:complexType name="EXT_formInputTypes">
>          <xs:complexContent>
>                <xs:extension base="formInputTypes">
>                      <xs:attribute name="isExt" type="xs:boolean" default="1"/>
>                </xs:extension>
>          </xs:complexContent>
>    </xs:complexType>
>
>    <xs:complexType name="SEQ_TYPE">
>           <xs:sequence>
>                <xs:element name="column" type="COL_TYPE"/>     <!-- COL_TYPE is
> undefined. could be xs:string for e.g -->
>           </xs:sequence>
>           <xs:attribute name="isExt" type="xs:boolean"/>
>    </xs:complextype>
>
> </xs:schema>
>
> As per this example, by default the type of "description" is
> EXT_formInputTypes. But if we add an attribute isExt = 0 (false) to
> "description" in the instance document, the type of "description"
> would be SEQ_TYPE.
>
> On Thu, Jun 16, 2011 at 7:07 AM, Karl Stubsjoen <[email protected]> wrote:
>> I have an element "description", who should either extend the
>> complexType "formInputTypes" or contain a sequence of "column"
>> elements.  Is this possible?
>>
>> --
>> Karl Stubsjoen
>> MeetScoresOnline.com
>> (602) 845-0006
>
>
>
>
>
> --
> Regards,
> Mukul Gandhi
>



-- 
Karl Stubsjoen
MeetScoresOnline.com
(602) 845-0006
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.