[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Mukul Gandhi" <gandhi.mukul@g...>
  • To: "Pete Cordell" <petexmldev@t...>
  • Date: Thu, 20 Sep 2007 22:21:04 +0530

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@t...> 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]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member