XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Type inheritance in XML Schema

Hi Pete,
   Thanks for the answer, and all the useful information. I really
like your idea about polymorphic usage of types. Thanks for telling me
about this.

On 9/20/07, Pete Cordell <petexmldev@tech-know-ware.com> wrote:
> As you've discovered, schema does not allow you to use xs:extension on
> xs:all.  This may change in XSD 1.1, but is something we have to live with
> for the time being.
>
> The easiest thing to do is change your xs:all statements to xs:sequence.  As
> you've noted, this would require the order to be fixed, but it's worth
> considering whether you really need the order to be variable.
>
> Another approach that would work in this case would be to use attributes to
> store the data.  In this case the order would not matter, and the semantics
> of what is allowed in terms of occurrences is very much xs:all like.
>
> Another observation is that, if you want your OBJECTS element to be more OO
> polymorphic like, the you could define it something like:
>
>    <xs:element name="OBJECTS">
>      <xs:complexType>
>          <xs:sequence>
>            <xs:element name="object" type="shape" maxOccurs="unbounded"/>
>          </xs:sequence>
>      </xs:complexType>
>    </xs:element>
>
> XML instances of that will look something like:
>
> <OBJECTS>
>    <object xsi:type='circle'...>...</object>
>    <object xsi:type='rectangle'...>...</object>
> </OBJECT>
> etc.
>
> HTH,
>
> Pete.
> --
> =============================================
> Pete Cordell
> Codalogic
> for XML Schema to C++ data binding visit
>  http://www.codalogic.com/lmx/
> =============================================


-- 
Regards,
Mukul Gandhi


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS