
Chapter 18 Working with XML
Choice & All
A choice allows you to display only one child in an instance of an element.
All allows you to display all the elements in the group once or not at all.
In PowerDesigner, you design a choice/all mostly as a sequence.
- If all the class attributes are defined in the choice/all, you should create a class without stereotype and set the class extended attribute isChoice/isAll to true. In the following example, all attributes of class InternationalShipping are defined in the choice:
<xsd:element name="InternationalShipping">
<xsd:choice>
<xsd:element name="EuropeShipping" type="int"/>
<xsd:element name="AfricaShipping" type="int"/>
<xsd:element name="AsiaShipping" type="int"/>
</xsd:choice>
</xsd:element>
- If some of the class attributes do not belong to the choice, you have to create a class containing the attributes belonging to the choice and assign the <<choice>>/<<all>> stereotype to this class. Create another class containing the other attributes. Select the Inner link tool in the palette and draw a link from the second class to the <<choice>>>>/<<all>> class:
You can also use the attribute migration feature to modify generation order among attributes. See Sequence paragraph for more details.
Copyright (C) 2006. Sybase Inc. All rights reserved.
|
|