Book a Demo

Author Topic: Choice elements - Generation of XML Schema  (Read 2820 times)

DrRob

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Choice elements - Generation of XML Schema
« on: September 06, 2004, 02:46:33 am »
Regarding XML Schema generationh, how do I represent complex type elements as choice children?

e.g.  How do I create a UML model that results in the following?
<xs:schema ... >
 <xs:element name="root">
   <xs:complexType>
     <xs:choice>
       <xs:element name="client">
         <xs:complexType>
           <xs:sequence>
             <xs:element name="cCode" type="xs:string"/>
           </xs:sequence>
         </xs:complexType>
       </xs:element>
       <xs:element name="supplier">
         <xs:complexType>
           <xs:sequence>
             <xs:element name="crRef" type="xs:string"/>
           </xs:sequence>
         </xs:complexType>
       </xs:element>
     </xs:choice>
   </xs:complexType>
 </xs:element>
</xs:schema>

Using the <<XSDChoice>> stereotype, children are modelled as Attributes and I cannont see how I can then specify children for each of these choice elements.  Is this possible?

Regards
Rob Campbell

DrRob

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Choice elements - Generation of XML Schema
« Reply #1 on: September 06, 2004, 07:51:16 am »
Seems this can be achieved by not specifying Attributes to the XSDchoice class but rather associating child classes to the XSDchoice class.